Ask a Question related to Coldfusion - Advanced Techniques, Design and Development.
-
kenji776 #1
How to make now() and different timezones get along
As my title and summary suggest, I just started using the now function, mainly
for keeping track of when users last logged in. The question is, how can I make
now work with different timezones. I know that I should have a field that users
specify what one they are in, then how do I use that with the now() function,
or something equivilant. Bascially I want to be able to tell what time it is,
anywhere in the world, easily, once users have specified what time zone they
are in so I can keep track of the last time they logged in and a few other
things.
kenji776 Guest
-
Converting Time between timezones?
Hi, ruby comes with the standard unix time conversion functions such as gmtime and localtime. Is there a simple method to convert time into... -
Countries and TimeZones
I want to make a list like http://www.rs-data.at/martin/ausgabe.html. People can enter the data at http://www.rs-data.at/martin/eingabe.html... -
[PHP] Timezones and Daylight Savings Time
What if you set the server to use UTC and then used the clients local system setting to offset it for each client? So the server would have it's... -
GNU make & make.pl are dead: long live Perl makepp
Hi, I have so far not seen the advantage of my 100% Perl syntax - at least not until Emacs learns to syntax highlight the specific parts. Since... -
PaulH #2
Re: How to make now() and different timezones get along
see
[url]http://www.macromedia.com/cfusion/webforums/forum/messageview.cfm?catid=3&thread[/url]
id=1027652&CFID=145465&CFTOKEN=989eca8c3946cc3f-2B093B57-02FD-D9B2-E90C13A3EF684
AF3&jsessionid=48304c83e49f7e266472 thread.
PaulH Guest
-
kenji776 #3
Re: How to make now() and different timezones get along
wow that page that you linked in the thread that you told me to is really cool.
Just why are there so many timezones? Its crazy! Overall that should probobly
do what i want it to... if i can figure out how to use that cfc, i havn't
looked at it yet.Thanks a bunch, hopefully i can get that to work for me.
kenji776 Guest
-
PaulH #4
Re: How to make now() and different timezones get along
because politicians control timezones. some places use DST, some don't. soem
sop/start DST different from surrounding areas. some of the timezones are
actually historical. also so many are included because its easy for people to
recognize their city/region rather than a UTC offset, etc.
PaulH Guest
-
kenji776 #5
Re: How to make now() and different timezones get along
Okay makes sence. Now then, im just a stupid kid trying to code this all, so
can you maybe give me a quick example on how i would go about using your cfc?
Say for instance I have a form field called form.timezone, a database field
called timezone, and a database field called last_logged_in that automatically
gets set each time someone logs in, using the now() function. How could I
incorperate your cfc to do what i need it to? Any help here is appreciated.
Thanks!
kenji776 Guest
-
PaulH #6
Re: How to make now() and different timezones get along
first off store your dates (note that you need a datetime not just a time) in a
single timezone (tz), UTC is usually a good choice.
<cfset tz=createObject("component","timeZone")> <!--- or wherever the CFC is
located --->
<cfquery name="getLogin" datasource="dsn">
SELECT last_logged_in,timezone
FROM someTable
WHERE user='#form.user#'
</cfquery>
<cfoutput>
#dateFormat(tz.castFromUTC(last_logged_in,timezone ))#
#timeFormat(tz.castFromUTC(last_logged_in,timezone ))#
</cfoutput>
PaulH Guest
-
kenji776 #7
Re: How to make now() and different timezones get along
Wow, timezones are confusing. I am suprised cold fusion doesn't have a built in
way to handle this, or a way to get the time from the users computer or
something, because this is crazyness. Thanks a bunch paul... but it looks like
this is a little over my head for the time being.
kenji776 Guest
-
PaulH #8
Re: How to make now() and different timezones get along
no, that's not crazy, that's just the way the world is. you might have a look
at [url]http://www.sustainablegis.com/tips/getClientTZ.cfm[/url]. it only works w/ie 6.0
and above (though the actual js gateway should be able to work w/firefox,
etc.).
PaulH Guest
-
kenji776 #9
Re: How to make now() and different timezones get along
Hmm that does look neat however it doesn't seem to work in firefox. I guess I
should try and do some more reaserach into how the UTC works before I try and
do things involving it. BTW you component really looks like it rocks, nice work
with that, I hope i can figure enough out to be able to use it in my site.
Again thanks for the help.
kenji776 Guest
-
PaulH #10
Re: How to make now() and different timezones get along
as i said i think that gateway should work, just that i wrote that bit for ie. you might contact the author (dan) about the gateway.
PaulH Guest



Reply With Quote

