Geekzone: technology news, blogs, forums
Guest
Welcome Guest.
You haven't logged in yet. If you don't have an account you can register now.


View this topic in a long page with up to 500 replies per page Create new topic
1 | 2 

mjb

mjb
996 posts

Ultimate Geek
+1 received by user: 67

Trusted

  #215744 18-May-2009 21:55
Send private message

I should add, this is a difficult problem, and is consistently an issue with web applications. Unless you have a few hours to set aside, and actually care about the problem, don't bother. :)




contentsofsignaturemaysettleduringshipping




mjb

mjb
996 posts

Ultimate Geek
+1 received by user: 67

Trusted

  #215745 18-May-2009 21:57
Send private message

freitasm: Oh, that... Yep, happy to do that.


Oh, ok, cool :)

I'd be interested to know how you do it if you do, I've not done any serious date/time work in windows.




contentsofsignaturemaysettleduringshipping


freitasm
BDFL - Memuneh
80682 posts

Uber Geek
+1 received by user: 41136

Administrator
ID Verified
Trusted
Geekzone
Lifetime subscriber

  #215747 18-May-2009 22:01
Send private message

mjb: Oh, ok, cool :)

I'd be interested to know how you do it if you do, I've not done any serious date/time work in windows.


Ah... So you suggest something you don't know how to do?

Anyway, we currently use this to get the OS current offset:

set oShell = server.CreateObject("WScript.Shell")
atb = "HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\TimeZoneInformation\ActiveTimeBias"
application("localOffset") = oShell.RegRead(atb)
set oShell = nothing

To calculate the offset we currently use this:

LocalDate = dateAdd("n", application("localOffset") - csng(session("timezone")), d)

where [d] is the date to convert...
 
So I just have to find how to read the timezone table to create the dropdown list, and use that to calculate the time. Also force all users who log into the site to change their timezone preferences on first login after we deploy this.






Referral links: Quic Broadband (free setup code: R587125ERQ6VE) | Samsung | AliExpress | Wise | Sharesies 

 

Support Geekzone by subscribing (browse ads-free), or making a one-off or recurring donation through PressPatron.

 




mjb

mjb
996 posts

Ultimate Geek
+1 received by user: 67

Trusted

  #215753 18-May-2009 22:23
Send private message

Like I said, I'm a *nix coder. it's like 4 lines in PHP :)

I've just done some research on this for ASP.NET, and my head is about to explode, I cannot believe that there's nothing available in the core libraries. best thing I found is this:

http://www.michaelbrumm.com/simpletimezone.html




contentsofsignaturemaysettleduringshipping


Zippity

683 posts

Ultimate Geek
+1 received by user: 132


  #215755 18-May-2009 22:39
Send private message

Jesus - all I said was the clock was out by one hour, only to be told that I had to make a simple change - which I did.

Now we are having a full blown debate on the issue Laughing

scottjpalmer
6035 posts

Uber Geek
+1 received by user: 792

Moderator
ID Verified
Trusted
Lifetime subscriber

  #215761 18-May-2009 22:50
Send private message

Zippity: Jesus - all I said was the clock was out by one hour, only to be told that I had to make a simple change - which I did.

Now we are having a full blown debate on the issue Laughing


This issue has raised itself many many many times. If Mauricio can sort it out to be automatic it will save the same questions being asked again and again in the future.

HP

 
 
 
 

Shop now for HP laptops and other devices (affiliate link).
nate
6473 posts

Uber Geek
+1 received by user: 458

Retired Mod
Trusted
Lifetime subscriber

  #215790 19-May-2009 00:12
Send private message

mjb:  Instead of storing the offset, store the *timezone*. Then it's a simple case of using the OS's TZ table to calculate the time of a given forum date (in GMT) in the user's timezone.


It's not quite that simple in the environment GZ is working in, I don't know of any easy way to do that in classic ASP without the need for a complex component.

freitasm is using the most straight forward method available.  You identify what the current time is where you are, and adjust it when we enter/exit DST.

Not the sexiest way of doing it, but this is what is achievable with the tools at hand Cool


edit: just realised there was a second page, and now my response doesn't fit.  Nothing to see here people, keep moving.

nate
6473 posts

Uber Geek
+1 received by user: 458

Retired Mod
Trusted
Lifetime subscriber

  #215791 19-May-2009 00:19
Send private message

mjb: Like I said, I'm a *nix coder. it's like 4 lines in PHP :)


A lot of stuff is easier in PHP than in ASP (I've been coding in both for some time).  For example, trying to format a date in ASP is a nightmare, PHP has the much easier date("lettersgohere") - sidenote: asp.NET supports the date formatting patterns.

mjb: I've just done some research on this for ASP.NET, and my head is about to explode, I cannot believe that there's nothing available in the core libraries.


I'm about to implement this in a project for a client, from my understanding when you create a datetime you set the timezone - once .net knows about what zone the time is in, it's not hard to calculate it in another timezone.




mjb

mjb
996 posts

Ultimate Geek
+1 received by user: 67

Trusted

  #215874 19-May-2009 12:24
Send private message

nate: I'm about to implement this in a project for a client, from my understanding when you create a datetime you set the timezone - once .net knows about what zone the time is in, it's not hard to calculate it in another timezone.


Yeah, apparently 3.5 has support for timezones other than just UTC and 'local timezone'. But the general idea is the same... instantiate an object/timestamp with a given TZ, usually GMT/UTC, and then calculate the time in another TZ by either updating the TZ on the object, or calling a method/function of some description to give the timestamp.

The link I gave to "SimpleTimeZone" for .NET looks pretty good for pre-3.5.

Out of interest, what is the ASP environment of GZ MF?




contentsofsignaturemaysettleduringshipping


1 | 2 
View this topic in a long page with up to 500 replies per page Create new topic








Geekzone Live »

Try automatic live updates from Geekzone directly in your browser, without refreshing the page, with Geekzone Live now.



Are you subscribed to our RSS feed? You can download the latest headlines and summaries from our stories directly to your computer or smartphone by using a feed reader.