what about the '/' i'll need since it is a date?
Main Topics
Browse All TopicsHello! I'm using the following java script to check the validity of dates that are entered. I need to concatenate the validated fields: startday, startmonth, startyear, etc. in the start_dt. The format should be a date startmonth/startday/starty
<cfform name="Insertform" method="post" action="./report_vacation.
<script language="JavaScript"><!--
function padout(number) { return (number < 10) ? '0' + number : number; }
function y2k(number) { return (number < 1000) ? number + 1900 : number; }
function validate(what) {
var startday = what.startday.options[what
var startmonth = what.startmonth.options[wh
var startyear = what.startyear.options[wha
var endday = what.endday.options[what.e
var endmonth = what.endmonth.options[what
var endyear = what.endyear.options[what.
unvalidstartdate = startday + '/' + startmonth + '/' + startyear;
unvalidenddate = endday + '/' + endmonth + '/' + endyear;
var startdate = new Date(startyear-0,startmont
var enddate = new Date(endyear-0,endmonth-1,
var validstartdate = padout(startdate.getDate()
var validenddate = padout(enddate.getDate()) + '/' + padout(enddate.getMonth()+
if (unvalidstartdate != validstartdate) {
alert('Start Date: ' + what.startday.options[what
' ' + what.startmonth.options[wh
' ' + what.startyear.options[wha
return false;
}
if (unvalidenddate != validenddate) {
alert('End Date: ' + what.endday.options[what.e
' ' + what.endmonth.options[what
' ' + what.endyear.options[what.
return false;
}
starttime = Date.UTC(y2k(startdate.get
endtime = Date.UTC(y2k(enddate.getYe
if (starttime < endtime) {
// valid
}
else {
alert('Start Date is not less than End Date');
return false
}
currentdate = new Date();
currenttime = Date.UTC(y2k(currentdate.g
if (starttime > currenttime) {
// valid
}
else {
alert('Start Date cannot be less then todays date');
return false;
}
what.startdate.value = validstartdate;
what.enddate.value = validenddate;
return true;
}
//--></script>
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Business Accounts
Answer for Membership
by: YZlatPosted on 2005-03-14 at 09:58:27ID: 13537154
try
start_dt=startmont + startday + startyear
or
start_dt=startmont & startday & startyear