LSDateFormat and Timezones

96 views
Skip to first unread message

Michael Forell

unread,
Feb 9, 2011, 9:18:23 AM2/9/11
to Railo
Hello,

can anyone confirm, this works on Adobe CF as expected (as it does not
on Railo Railo 3.1.2.019+).
<cfoutput>#LSDateFormat(Now(), "mmmm dd, yyyy h:mm:ss tt zzz")#</
cfoutput>
In Railo I get 'February 09, 2011 h:02:ss tt zzz'.
Related to http://livedocs.adobe.com/coldfusion/8/htmldocs/functions_l_36.html#133322
it should output something like "CET" in the end or is this a known
limitation.

Actually I'm trying to output a timezone'name' like CET/PST.


Thanks in advance
Michael

Peter Boughton

unread,
Feb 9, 2011, 9:30:51 AM2/9/11
to ra...@googlegroups.com
You need to use both LSDateFormat and LSTimeFormat - there isn't a
function in CFML that handles them both.

(Those docs are relating to *parsing* date/time information from
strings, not formatting a date/time object as a string.)

Also, does that exact code *really* work work in ACF? Which version?
I'd be surprised that it distinguishes between month/minute correctly.

Michael Offner

unread,
Feb 9, 2011, 9:39:57 AM2/9/11
to ra...@googlegroups.com
this is a valid output and ACF will return exact the same.
your link shows lsParseDateTime function that parse date and time from a string. this has nothing to do with lsDateFormat.

lsDateFormat formats handles only the date part of a datetime object, to format the time of a dateTime object you need the function, lsTimeFormat and yes there is no lsDateTimeFormat function (at the moment).
but also the function lsTimeFormat does not understand "zzz".
you only can do it this way at the moment.

<cfset setLocale("english (us)")>
<cfoutput>
#LSDateFormat(Now(), "mmmm dd, yyyy")# #LSTimeFormat(Now(), "h:mm:ss tt")# #getTimeZone()#
</cfoutput>

/micha

p.s. i think it is a good idea to teach the function lsTimeFormat to understand "zzz", can you please open a ticket for this



2011/2/9 Michael Forell <mich...@gmx.net>

Michael Offner

unread,
Feb 9, 2011, 10:29:22 AM2/9/11
to ra...@googlegroups.com
i have added this functionality to lsTimeFormat

/micha


2011/2/9 Michael Offner <mic...@getrailo.com>

Michael Forell

unread,
Feb 9, 2011, 10:38:27 AM2/9/11
to Railo
Thanks! That's quite fast.

On 9 Feb., 16:29, Michael Offner <mich...@getrailo.com> wrote:
> i have added this functionality to lsTimeFormathttps://issues.jboss.org/browse/RAILO-1181
>
> /micha
>
> 2011/2/9 Michael Offner <mich...@getrailo.com>
>
>
>
>
>
>
>
> > this is a valid output and ACF will return exact the same.
> > your link shows lsParseDate*Time* function that parse date *and time* from
> > a string. this has nothing to do with lsDateFormat.
>
> > lsDateFormat formats handles only the date part of a datetime object, to
> > format the time of a dateTime object you need the function, lsTimeFormat and
> > yes there is no lsDateTimeFormat function (at the moment).
> > but also the function lsTimeFormat does not understand "zzz".
> > you only can do it this way at the moment.
>
> > <cfset setLocale("english (us)")>
> > <cfoutput>
> > #LSDateFormat(Now(), "mmmm dd, yyyy")# #LSTimeFormat(Now(), "h:mm:ss tt")#
> > #getTimeZone()#
> > </cfoutput>
>
> > /micha
>
> > p.s. i think it is a good idea to teach the function lsTimeFormat to
> > understand "zzz", can you please open a ticket for this
>
> > 2011/2/9 Michael Forell <michae...@gmx.net>
>
> > Hello,
>
> >> can anyone confirm, this works on Adobe CF as expected (as it does not
> >> on Railo Railo 3.1.2.019+).
> >> <cfoutput>#LSDateFormat(Now(), "mmmm dd, yyyy h:mm:ss tt zzz")#</
> >> cfoutput>
> >> In Railo I get 'February 09, 2011 h:02:ss tt zzz'.
> >> Related to
> >>http://livedocs.adobe.com/coldfusion/8/htmldocs/functions_l_36.html#1...

Michael Offner

unread,
Feb 9, 2011, 10:44:00 AM2/9/11
to ra...@googlegroups.com
was a piece of cake to implement

/micha

2011/2/9 Michael Forell <mich...@gmx.net>
Reply all
Reply to author
Forward
0 new messages