ASP Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreASP Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now!
  #1  
Old July 22nd, 2003, 05:57 PM
benseri benseri is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2003
Location: Israel
Posts: 102 benseri User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
Send a message via ICQ to benseri
GMT Problem

I maid an ASP in wich I used the Normal Time & Date Functions, One Problem Though The GMT That I have and the GMT the ASP Server Has are diffrent.

I Could of course add in the ASP the time diffrence to the Time function, But I also want it to be a 24-hour clock and the Server has a PM/AM clock.
Is their a function or any other way that I Could Get The User's Time and not the Server's Time?

Ben.

Reply With Quote
  #2  
Old July 22nd, 2003, 09:05 PM
unatratnag unatratnag is offline
Average Intelligence
Dev Shed Novice (500 - 999 posts)
 
Join Date: Apr 2003
Location: Ohio/Chicago
Posts: 678 unatratnag User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 10 m 22 sec
Reputation Power: 6
Send a message via AIM to unatratnag
You can do it in client side javascript - by getting the utc date and looking at the offset from GMT at the end of the string.

Or, this is more server intensive....

Send the following code to the client, and if they have javascript enabled you'll get an immediate automatic POST back to "somepage.asp" with the form variable "tz" containing the users timezone offset.

Note the manual override in case the user is not running javascript. You could enhance this and provide a form for the user to select their timezone if you do not get an automatic SUBMIT.

<html>

<body>

<form name='detect' method='post' action='somepage.php'>

<input type='hidden' name='tz' value='unknown'>

</form>

Detecting timezone...

<a href='somepage.asp'>Click Here</a> if this page does not automatically redirect...

<script type='text/javascript'>

var now = new Date();

document.detect.tz.value = now.gettimezoneOffset();

document.detect.submit();

</script>

</body>

</html>

Reply With Quote
  #3  
Old July 23rd, 2003, 04:09 AM
benseri benseri is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2003
Location: Israel
Posts: 102 benseri User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
Send a message via ICQ to benseri
Thanks a lot, But is this function (now.gettimezoneOffset) availble only in javascript?
Is it availble in VBscript or plain ASP?

Reply With Quote
  #4  
Old July 23rd, 2003, 05:15 AM
unatratnag unatratnag is offline
Average Intelligence
Dev Shed Novice (500 - 999 posts)
 
Join Date: Apr 2003
Location: Ohio/Chicago
Posts: 678 unatratnag User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 10 m 22 sec
Reputation Power: 6
Send a message via AIM to unatratnag
as far as i know

you can mix javascript and vbscript if that's what you're worried about

Reply With Quote
  #5  
Old July 23rd, 2003, 06:40 AM
benseri benseri is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2003
Location: Israel
Posts: 102 benseri User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
Send a message via ICQ to benseri
The script I wrote dosen't work, An error is recived:
"A runtime error has occurred...
Line: 18
Error: Object Dosen't Support property or method."

what should I do?

Reply With Quote
  #6  
Old July 23rd, 2003, 07:21 AM
unatratnag unatratnag is offline
Average Intelligence
Dev Shed Novice (500 - 999 posts)
 
Join Date: Apr 2003
Location: Ohio/Chicago
Posts: 678 unatratnag User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 10 m 22 sec
Reputation Power: 6
Send a message via AIM to unatratnag
probably post your code =P

Reply With Quote
  #7  
Old July 23rd, 2003, 07:27 AM
benseri benseri is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2003
Location: Israel
Posts: 102 benseri User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
Send a message via ICQ to benseri
I ment that Your Script Didn't work:

<html>

<body>

<form name='detect' method='post' action='somepage.php'>

<input type='hidden' name='tz' value='unknown'>

</form>

Detecting timezone...

<a href='somepage.asp'>Click Here</a> if this page does not automatically redirect...

<script type='text/javascript'>

var now = new Date();

document.detect.tz.value = now.gettimezoneOffset();

document.detect.submit();

</script>

</body>

</html>
"

with the same error message...

Reply With Quote
  #8  
Old July 23rd, 2003, 07:49 AM
unatratnag unatratnag is offline
Average Intelligence
Dev Shed Novice (500 - 999 posts)
 
Join Date: Apr 2003
Location: Ohio/Chicago
Posts: 678 unatratnag User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 10 m 22 sec
Reputation Power: 6
Send a message via AIM to unatratnag
hmmmm.... I'm not getting any errors, but the date (gettimezoneoffset) method isn't working.... I must have errors turned off or something.....

var rightNow = new Date();
var date1 = new Date(rightNow.getFullYear(), 0, 1, 0, 0, 0, 0);
var date2 = new Date(rightNow.getFullYear(), 6, 1, 0, 0, 0, 0);
var temp = date1.toGMTString();
var date3 = new Date(temp.substring(0, temp.lastIndexOf(" ")-1));
var temp = date2.toGMTString();
var date4 = new Date(temp.substring(0, temp.lastIndexOf(" ")-1));
var hoursDiffStdTime = (date1 - date3) / (1000 * 60 * 60);
var hoursDiffDaylightTime = (date2 - date4) / (1000 * 60 * 60);
if (hoursDiffDaylightTime == hoursDiffStdTime) {
alert("Time zone is GMT " + hoursDiffStdTime + ".\nDaylight Saving Time is NOT observed here.");
} else {
alert("Time zone is GMT " + hoursDiffStdTime + ".\nDaylight Saving Time is observed here.");
}

this i know works, it will give you the time zone offset of grinnich mean time.... i'll get back to you on the other script... i'm not sure why that method wouldn't work anymore.....

Reply With Quote
  #9  
Old July 23rd, 2003, 08:05 AM
unatratnag unatratnag is offline
Average Intelligence
Dev Shed Novice (500 - 999 posts)
 
Join Date: Apr 2003
Location: Ohio/Chicago
Posts: 678 unatratnag User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 10 m 22 sec
Reputation Power: 6
Send a message via AIM to unatratnag
OK, now i need help, why won't the get timezone above work but here it will work?

<script type='text/javascript'>

var now = new Date();
document.writeln("<h3>The offset from GMT is "+now.getTimezoneOffset()+"</h3>");

This is frustrating.....

well there's 2 functions you can use for hours or minutes offset, i can't explain why that first one isn't working.....

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreASP Programming > GMT Problem


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway