Here is what I ended up doing:

<cffunction name="ExtendedTimeFormat" returntype="string">
<cfargument name="time" type="string" required="true">
<cfargument name="mask" type="string" required="false" default="hh:mm tt">
<cfset var timezone = ListLast( TimeFormat( Now( ),"long" )," " )>
<cfset var resultstring = TimeFormat( time,mask )>
<cfset resultstring = Replace( resultstring,"zz",timezone,"ALL" )>
<cfreturn resultstring>
</cffunction>

#ExtendedTimeFormat( Now(),"HH:mm zz" )# returns what I am looking for.

I have decided to challenge myself, however. Aside from the use of
<cffunction>, the above udf will not work on CF5 because of the lack of
support for long and full as masks, and the fact that any non-mask
characters are converted into an apos' delimitated list. If you have any
insight, please let me know. I am looking into GetTimeZoneInfo() then hand
writing a struct of arrays holding time zones and offsets, then picking one
based on offset. This also allows for "zzz" for outputting the full time
zone name.  Thanks for the help

Bill Henderson
[EMAIL PROTECTED]

-----Original Message-----
From: Matthew Walker [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, August 20, 2003 7:17 PM
To: CF-Talk
Subject: RE: Time zone mask characters

I think the best solution might be to write a udf:

Function getTimeZone() {
        Return ListLast(TimeFormat(Now(),"long")," ")
}

or you could write your own extraspecialtimeformat() function that applied
the regular timeformat() fn then replaced any "z" with the tz.


> -----Original Message-----
> From: Bill Henderson [mailto:[EMAIL PROTECTED]
> Sent: Thursday, 21 August 2003 1:16 p.m.
> To: CF-Talk
> Subject: RE: Time zone mask characters
> 
> Thanks, I was hoping that was not going to be the only way, because I
> would
> have to do it like this:
> 
> "#TimeFormat( Now( ),"HH:mm" )# #ListLast( TimeFormat( Now( ),"long" )," "
> )# "
> 
> In order return a string of "23:05 PDT" - And that seems a bit kludgy. I
> submitted a feature request to MM, although I believe that this would
> probably not be a commonly needed feature.
> 
> Bill Henderson
> [EMAIL PROTECTED]
> 
> -----Original Message-----
> From: Matthew Walker [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, August 20, 2003 3:16 PM
> To: CF-Talk
> Subject: RE: Time zone mask characters
> 
> You could use listlast(TimeFormat( Now( ),"long" ), " ") as a work around
> to
> get the time zone.
> 
> > -----Original Message-----
> > From: Bill Henderson [mailto:[EMAIL PROTECTED]
> > Sent: Thursday, 21 August 2003 8:23 a.m.
> > To: CF-Talk
> > Subject: Time zone mask characters
> >
> > Hello All -
> >
> > When you do TimeFormat( Now( ),"long" ) or TimeFormat( Now( ),"full" )
> it
> > returns strings with the time zone at the end like so: 2:25:18 AM PDT.
> >
> > My question is, what are the mask characters to get the time zone to
> > display
> > if you don't use "long" or "full" as the mask? I can't find anything in
> > the
> > docs about it.
> >
> > More specifically, I want to show the date as 24 hour time, like this:
> > TimeFormat( Now( ),"HH:mm ZZ" ) with ZZ being the time zone.
> >
> >
> > Bill Henderson
> > [EMAIL PROTECTED]
> >
> >
> 
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/lists.cfm?link=t:4
Subscription: http://www.houseoffusion.com/lists.cfm?link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Get the mailserver that powers this list at 
http://www.coolfusion.com

Reply via email to