[thelist] international dates in CF
Oliver Lineham
oliver at lineham.co.nz
Mon Nov 27 17:51:45 CST 2000
hi all,
i'm having trouble getting CF to work with international format dates sanely.
i've got a string (actually straight from a SQL query) in the format:
YYYY-MM-DD HH:MM:SS
as i need to pull the year, month, and day from this the datepart()
function would seem to be the natural choice, but here's the problem:
datepart() seems to assume the format YYYY-DD-MM (god knows why) unless MM > 12
ie. it works correctly for these datetimes:
2000-11-27 00:00:00
2000-10-28 00:00:00
because the dates are unambiguous.
but it gets these wrong:
2000-11-08 00:00:00 (assumes 11th of August)
2000-11-01 00:00:00 (assumes 1st of January)
why is it acting so silly? YYYY-MM-DD is supposed to be the most
unambiguous international date format. the dates going into and out of the
database are definitely correct, because they come out in the right order
when ORDER BY'd.
one solution i can think of would be to reverse the functions and use
#datepart("m", thedatestring)# when i want the day, and
#datepart("d", thedatestring)# when i want the month -- but that's an ugly
solution.
any better ideas?
</ol>
____________________________________________________
v i b e m e d i a http://www.vibe.co.nz/
po box 10-492 wellington, new zealand
phone +64 21 210-7845 oliver at lineham.co.nz
More information about the thelist
mailing list