SitePoint Sponsor |
|
User Tag List
Results 1 to 6 of 6
Thread: Local Time?
-
Nov 13, 2006, 19:26 #1
Local Time?
How can I get my application to use the time off os my browser..
Example-
Server is in the US .. time is 7:00pm on Monday 13th
Main Office is in Japan .. time is 10:00am Tuesday 14th
Branch in Germany .. time is 2:00am Tuesday 14th
When I have an Employee register at 11:00am in the Japan Office, the time it shows the user registered is 8:00pm.. Is there a way to get NOW() to pull from the browser time... Or is there some sort of Timezone Database I can use to calculate the appropriate times.??
-
Nov 14, 2006, 04:23 #2
- Join Date
- Jul 2004
- Location
- Leicester, UK
- Posts
- 871
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
i think 'LSDateFormat' is the way to go:
http://www.cfquickdocs.com/?getDoc=LSDateFormat
-
Nov 14, 2006, 04:26 #3
hi bloodfest
I think you can do either of the three things.
1) Perhaps you can ask the user while registering the offset to GMT (a +/- value).
You can store it as a float and use it to display time as for the user. The
bad thing with this is that most people dont know what this stuff is.
2) By some method (3 dropdowns are ideal) ask the user what the local time is.
compare it with the server time, find the offset. This is more practical but
it is little bit tricky to compute offset considering the crossing of
International Date Line and Daylight saving hours in many countries.
3) if you just need to display time of the user who is before the computer
and if you dont actually need to do any computation based on it, use some
client side javascript which could show the formatted date of the local
browser.
I had to deal with such a situation in my good old days and I somehow
managed to proceed with the 2nd option.
-Ramesh
-
Nov 14, 2006, 08:44 #4
- Join Date
- Oct 2000
- Location
- Nashvegas Baby!
- Posts
- 7,845
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
You could also just get the user to input the current time, then calculate the offset yourself.
Adobe Certified Coldfusion MX 7 Developer
Adobe Certified Advanced Coldfusion MX Developer
My Blog (new) | My Family | My Freelance | My Recipes
-
Nov 14, 2006, 20:49 #5
Here is what I'm trying.. I have Offices in 4 Locations..
2 in Japan
2 in Germany
Look-up table looks like this..
Code:Location TimeZone LocationID Okinawa, Japan 15 1 Misawa, Japan 15 2 Ramstein, Germany 7 3 Berlin, Germany 7 4
A user logs in and belongs to one of the locations..
ie, Okinawa, Japan
All transactions done by the users that will track by Timestamp with use the following:
#DateFormat(DateAdd('h',sql_check_timezone.TimeZone,NOW()),'yyyy-mm-dd')#
#TimeFormat(DateAdd('h',sql_check_timezone.TimeZone,NOW()),'HH:mm:ss')#
Some users ie, PowerUsers and Admin can switch between locations at any time and will always be in the right time zone..
I think I may run into problems if there are any daylight savings time..
-
Nov 17, 2006, 15:10 #6
- Join Date
- Jul 2005
- Posts
- 609
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
If you know what time zones your users are in, use timezone.cfc:
http://www.coldfusionusers.com/cfblo...h-timezonecfc/
Takes care of all that DST stuff for you
Bookmarks