Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DateAdd with strange result !

Status
Not open for further replies.

midway

Programmer
Dec 21, 2000
1
0
0
FR
Hi everyone,

When I try to add a number of month to a StartDate ( to get the EndDate) I have some strange result. Following is the code:

<TD WIDTH=300><CFINPUT TYPE=&quot;text&quot; NAME=&quot;StartDate&quot; VALUE=&quot;#Trim(StartDate)#&quot; SIZE=25 VALIDATE =&quot;eurodate&quot;></TD>

<TD WIDTH=300><CFINPUT TYPE=&quot;text&quot; NAME=&quot;EndDate&quot; VALUE=&quot;#DateFormat(DateAdd('M',Plan,StartDate), &quot;DD/MM/YY&quot;)#&quot; SIZE=25 VALIDATE =&quot;eurodate&quot;></TD>

The StartDate have the format DD/MM/YY

The problem is when I add 12 ( Plan=12) to the month of the startdate like 21/01/00 I get the result is 1/01/21. What it should show is 21/01/01. It looks like somehow the YEAR is missplace !!! I set date is short day type in MS Access for both endday, startday and eurodate in Coldfusion( ver 4)

I don't have this problem at all if the number of month I add is less than 12

Could someone give me a hint to what happen here and how could I go around this problem ?

Thanks in advance.
 
Try using the date format as dd/mmm/yyyy

This might be due to the regional setting(date format) of your system

hope this works :)

Perichazhi
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top