a BIF in CF. There is no need to use a custom tag to do something this simple
No, the problem here is not with formating the date.
The only thing LSDateFormat does is to provide a different default mask, depending on the locale setting,
and output days and month names in the local language.
But whatever the local setting is, CF will still convert a string to a date the same way, ie assuming the date is
in American format first.
Just try the following code:
<CFSET temp = setLocale ("English (Australian)")>
<CFSET date1 = "02/08/2004">
<CFOUTPUT>
date1 is #LSDateFormat(date1, 'dd/mm/yyyy')# - #LSDateFormat(date1, 'dd mmm yyyy')#
</CFOUTPUT>
It will still claim the date is 08/02/2004 - 08 Feb 2004
In order to make sure the date is converted and passed correctly, you have only two solutions:
1. use create date on the string, ie:
<CFSET date1 = "02/08/2004">
<CFSET date1 = createDate(mid(date1, 7, 4), mid(date1, 4, 2), mid(date1, 1, 2))>
Then date 1 is a date AND it is correct, ... or
2. use function convertDate :
<CFSET date1 = convertDate(date1, "string", "date", "dd/mm/yyyy")>
If you prefer method 1, its up to you, I found more convenient to make convertDate once for all.
convertDate is just a kind of unFormatDate function. The advantage is that YOU provide the mask,
you don't let CF guess what format the date should be.
--
_______________________________________
REUSE CODE! Use custom tags;
See http://www.contentbox.com/claude/customtags/tagstore.cfm
(Please send any spam to this address: [EMAIL PROTECTED])
Thanks.
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]

