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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Date Stupididty

Status
Not open for further replies.

Sarky78

Programmer
Joined
Oct 19, 2000
Messages
878
Location
GB
Hi there,

I have a date that is stored in a database that i want to output in the format dd-mmm-yyyy. the date is created using the line,

<CFSET datecreate = CreateODBCDateTime(Now())>

this is adding an entry to the database as:

03/12/01 7:09:32 PM

which is where i think the problem is lying, when i do a dateformat on this with the mask as &quot;dd-mmm-yyyy&quot; i get 12-March-01!!!. dates that are for november are stored in the database like this:

11/30/01 2:53:51 PM

and when i do the same dateformat on this i get the correct date out (30-Nov-2001) what the heck is going on here. We are using CF 4 (I know we need to upgrade, but tell the boss !) and like i said all of the other dates are working fine it is just dates for dec !

any ideas ?
 
Well, here's my $.02 worth,(which is probably being generous!), but here it goes. I was unable to reproduce your error, but I did find a couple of things you might want to consider. The first is, that &quot;dd-mmmm-yy&quot; is the default format that DateFormat will return if no mask is specified. I know you did specify a mask, but info might help. The other thing is, (and I know this might not be practical in your situation)that according to the reading I've done, it's generally considered best to store your date in the database as a date/time object, and format it when you want to display or print it. Sorry I don't have more for you. Calista :-X
Jedi Knight,
Champion of the Force
 
right the moron that wrote the database should be killed (that was me by the way !) forgot to set the data type to date time now it is working fine, i guess that it was just fluking the format the other times !!!

cheers for your help !
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top