CreateODBCDatetime tale of caution

I have a scedule task which runs daily and we've noticed that at the begining of the month it has been behaving oddly. Its been changing dates around. i.e its been converting 2006-08-03 to 2006-08-30. Below is an example of whats happend:

Before: {ts '2006-08-01 13:01:00'}   After: {ts '2006-08-10 00:00:00'}

Posted: 07-Aug-2006

View: 1306

Permalink: here

Comments

Wouldn't createOdbcDate(now()) give you what you want?

#1 Dave Ross
07/Aug/06 3:22 PM

Im setting the time to midnight as well though.

#2 Andy Jarrett
07/Aug/06 7:01 PM

I know... doesn't createOdbcDate() default to 12:00 midnight? Or is that up to the DBMS?

#3 Dave Ross
07/Aug/06 9:03 PM

I always just thought that was down to the DBMS and really didnt want to leave that to chance? Either way I suppose its better to be save than sorry :o)

#4 Andy Jarrett
07/Aug/06 11:22 PM

cf datetimes are decimal days since it's epoch. this should strip the time: createODBCDATETIME(int(now())).

#5 PaulH
08/Aug/06 3:52 AM