| Welcome to Webforumz.com. |
|
Dec 21st, 2007, 08:36
|
#1 (permalink)
|
|
Most Reputable Member
Join Date: Feb 2004
Location: Borneo
Age: 27
Posts: 1,567
|
ASP Capturing User Time Zone
Does anyone know how to do this the ASP way?
What I want to do in my site is to display each registered user their own time zone. Say, my place now would be Friday 17:30, and swagner would be Thursday 04:30.
During the registration process, I have allow the user to select their own time zone and later saved it into the database.
I will have a member list page to display all this registered user in a list format. At the end of each field, I will display this information so that I know what is the real time for each of my member list
Any guide 
Cheers and merry Christmas.
__________________
|
|
|
Dec 21st, 2007, 12:15
|
#2 (permalink)
|
|
Up'n'Coming Member
Join Date: Sep 2007
Location: Wales, UK
Age: 35
Posts: 75
|
Re: ASP Capturing User Time Zone
When they are registering you could use a drop down list like this - http://www.csgnetwork.com/timezonedropdown.html - Set the values on the drop down to the corespondin - & + hours and write it away to your database, then you can use the DateDiff function to display the correct time for the user when they login.
__________________
Languages: ASP, RUBY(a little), XML, XHTML, CSS, JavaScript, JQuery - www.bizmo.co.uk
|
|
|
Dec 22nd, 2007, 02:05
|
#3 (permalink)
|
|
Most Reputable Member
Join Date: Feb 2004
Location: Borneo
Age: 27
Posts: 1,567
|
Re: ASP Capturing User Time Zone
I am using something similar like this drop down menu (from webforumz):
- HTML: Select all
<select name="timezoneoffset" id="sel_timezoneoffset">
<option value="-12" class="fjdpth0" >(GMT -12:00) Eniwetok, Kwajalein</option>
<option value="-11" class="fjdpth0" >(GMT -11:00) Midway Island, Samoa</option>
<option value="-10" class="fjdpth0" >(GMT -10:00) Hawaii</option>
<option value="-9" class="fjdpth0" >(GMT -9:00) Alaska</option>
<option value="-8" class="fjdpth0" >(GMT -8:00) Pacific Time (US & Canada)</option>
<option value="-7" class="fjdpth0" >(GMT -7:00) Mountain Time (US & Canada)</option>
<option value="-6" class="fjdpth0" >(GMT -6:00) Central Time (US & Canada), Mexico City</option>
<option value="-5" class="fjdpth0" >(GMT -5:00) Eastern Time (US & Canada), Bogota, Lima</option>
<option value="-4" class="fjdpth0" >(GMT -4:00) Atlantic Time (Canada), Caracas, La Paz</option>
<option value="-3.5" class="fjdpth0" >(GMT -3:30) Newfoundland</option>
<option value="-3" class="fjdpth0" >(GMT -3:00) Brazil, Buenos Aires, Georgetown</option>
<option value="-2" class="fjdpth0" >(GMT -2:00) Mid-Atlantic</option>
<option value="-1" class="fjdpth0" >(GMT -1:00 hour) Azores, Cape Verde Islands</option>
<option value="0" class="fjdpth0" >(GMT) Western Europe Time, London, Lisbon, Casablanca</option>
<option value="1" class="fjdpth0" >(GMT +1:00 hour) Brussels, Copenhagen, Madrid, Paris</option>
<option value="2" class="fjdpth0" >(GMT +2:00) Kaliningrad, South Africa</option>
<option value="3" class="fjdpth0" >(GMT +3:00) Baghdad, Riyadh, Moscow, St. Petersburg</option>
<option value="3.5" class="fjdpth0" >(GMT +3:30) Tehran</option>
<option value="4" class="fjdpth0" >(GMT +4:00) Abu Dhabi, Muscat, Baku, Tbilisi</option>
<option value="4.5" class="fjdpth0" >(GMT +4:30) Kabul</option>
<option value="5" class="fjdpth0" >(GMT +5:00) Ekaterinburg, Islamabad, Karachi, Tashkent</option>
<option value="5.5" class="fjdpth0" >(GMT +5:30) Bombay, Calcutta, Madras, New Delhi</option>
<option value="6" class="fjdpth0" >(GMT +6:00) Almaty, Dhaka, Colombo</option>
<option value="7" class="fjdpth0" >(GMT +7:00) Bangkok, Hanoi, Jakarta</option>
<option value="8" class="fjdpth0" selected="selected">(GMT +8:00) Beijing, Perth, Singapore, Hong Kong</option>
<option value="9" class="fjdpth0" >(GMT +9:00) Tokyo, Seoul, Osaka, Sapporo, Yakutsk</option>
<option value="9.5" class="fjdpth0" >(GMT +9:30) Adelaide, Darwin</option>
<option value="10" class="fjdpth0" >(GMT +10:00) Eastern Australia, Guam, Vladivostok</option>
<option value="11" class="fjdpth0" >(GMT +11:00) Magadan, Solomon Islands, New Caledonia</option>
<option value="12" class="fjdpth0" >(GMT +12:00) Auckland, Wellington, Fiji, Kamchatka</option>
</select>
But what I do not understand is the DateDiff function!
I know that it is used for differentiating two date and get the different between them.
How do I apply this function?
__________________
Last edited by Monie; Dec 22nd, 2007 at 02:15.
|
|
|
Dec 28th, 2007, 02:56
|
#4 (permalink)
|
|
Most Reputable Member
Join Date: Feb 2004
Location: Borneo
Age: 27
Posts: 1,567
|
Everyone is on CHRISTMAS VACATION huh?
Perhaps MIXING JavaScript with ASP? Let me try my luck.. 
__________________
Last edited by Monie; Dec 28th, 2007 at 07:27.
Reason: make thread looks neat..
|
|
|
Dec 29th, 2007, 19:53
|
#5 (permalink)
|
|
Junior Member
Join Date: Oct 2007
Location: Israel
Age: 20
Posts: 31
|
Re: ASP Capturing User Time Zone
do it on javascript.
make countries array (country, value, GMT) and loop it to a select box.
then make the "if" term
- PHP: Select all
if (countries_arr("GMT") = user_GMT) document.write "selected='selected'";
i think i got errors on that code O_o
simple thought :}
now, how do we get the user GMT?
- PHP: Select all
var d = new Date() var gmtHours = d.getTimezoneOffset()/60; document.write("The local time zone is: GMT " + gmtHours);
learn js :P
____________
look on the samples here - DateDiff
|
|
|
Dec 31st, 2007, 02:03
|
#6 (permalink)
|
|
Most Reputable Member
Join Date: Feb 2004
Location: Borneo
Age: 27
Posts: 1,567
|
Re: ASP Capturing User Time Zone
I did not have any problem displaying the user time!
My problem is, in my page, I have a special page that will display all the user (that was currently online) in a list form.. and I wanted to display THEIR real-time clock!
Something like this:
+--------+----------------------+
| User 1 | 10:30am Sunday |
+--------+----------------------+
| User 2 | 23:30pm Saturday |
+--------+----------------------+
| User 3 | 05:30am Sunday |
+--------+----------------------+
__________________
Last edited by Monie; Dec 31st, 2007 at 02:06.
|
|
|
Dec 31st, 2007, 06:55
|
#7 (permalink)
|
|
Most Reputable Member
Join Date: Feb 2004
Location: Borneo
Age: 27
Posts: 1,567
|
Re: ASP Capturing User Time Zone
I found a way in ASP but couldn't seems to fulfill my requirement
- HTML: Select all
Borneo<%=TimeZone(0,0,0)%>
New York Time<%=TimeZone(0,13,0)%> 'minus 13 hours from local time
will print:
My Time: 11:00 AM
New York Time: 10:00 PM
without the DAY..
I need to print the day as well. It suppose to be like this:
My Time: 11:00 AM Monday
New York Time: 10:00 PM Sunday
__________________
Last edited by Monie; Jan 2nd, 2008 at 01:37.
Reason: bump thread!
|
|
|
Jan 11th, 2008, 12:19
|
#8 (permalink)
|
|
Junior Member
Join Date: Oct 2007
Location: Israel
Age: 20
Posts: 31
|
Re: ASP Capturing User Time Zone
okay then
i think the best way to do that is to retrieve from the user his GMT (btw, you can do it from the ip.. search for ip to country script or something like it). the user will fill his GMT to your db and you will calculate the time and zone :}
i think that date difference can do that but i'm not sure. anyway this isn't that hard script and with a little effort you can do this by your own. good luck!
tell us what you thought of.. or if you need any help.
|
|
|
Jan 12th, 2008, 10:01
|
#9 (permalink)
|
|
Administrator
Join Date: Jul 2007
Location: Webforumz 24/7
Age: 15
Posts: 4,102
|
Re: ASP Capturing User Time Zone
Why not:
- Code: Select all
Response.Write(TimeZone(0,13,0) & FormatDateTime(Date, 1))
That would work wouldn't it?
__________________
Languages: PHP, mySQL (queries), C#, (X)html, CSS, JS.
|
|
|
Jan 13th, 2008, 23:43
|
#10 (permalink)
|
|
Most Reputable Member
Join Date: Feb 2004
Location: Borneo
Age: 27
Posts: 1,567
|
Re: ASP Capturing User Time Zone
I didn't have enough time to solve this problem, being a bit busy lately.. 
I'll look at it ASAP, Thanks for all the suggestion.
Let me have a look at your idea Eran, thanks.
__________________
|
|
|
| Thread Tools |
|
|
| Rate This Thread |
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|
|