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

DateFormat

Status
Not open for further replies.
Aug 18, 2003
111
GB
I have a csv file that i'm trying to load into a mysql database, using a coldfusion page.

In the csv file the date is in the format dd/mm/yyyy but when i use #dateformat(string,"yyyy-mm-dd")# to store it in my database, if the date is at the begging of the month then it swaps the day and the month. For example:

03/08/2005 = #dateformat(string,"yyyy-mm-dd")# = 2005-03-08 instead of 2005-08-03

Is there a way to stop this?
 
if you're using coldfusion instead of just loading the csv straight into mysql using a load utility, then why not use substring functions to assemble the pieces of the string into a format that coldfusion will recognize correctly

if you say #dateformat(string,"yyyy-mm-dd")# you are relying on coldfusion first to interpret the string correctly, and then display it in the specified format

it's not interpreting it correctly unless you help it

r937.com | rudy.ca
 
I've seen this before on some platforms such as Ingres - what database/driver?

what happens if you create a datatiem object from the data using lsParse date or createODBCDate or something similar then try and format? Try setting the locale and using LsDateFormat

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top