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

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

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
79316 posts

Uber Geek

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.






Please support Geekzone by subscribing, or using one of our referral links: Quic Broadband (free setup code: R587125ERQ6VE) | Samsung | AliExpress | Wise | Sharesies | Hatch | GoodSync 




mjb

mjb
996 posts

Ultimate Geek

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


  #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
5973 posts

Uber Geek

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.

nate
6473 posts

Uber Geek

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.

 
 
 

Trade NZ and US shares and funds with Sharesies (affiliate link).
nate
6473 posts

Uber Geek

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

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





News and reviews »

Gen Threat Report Reveals Rise in Crypto, Sextortion and Tech Support Scams
Posted 7-Aug-2025 13:09


Logitech G and McLaren Racing Sign New, Expanded Multi-Year Partnership
Posted 7-Aug-2025 13:00


A Third of New Zealanders Fall for Online Scams Says Trend Micro
Posted 7-Aug-2025 12:43


OPPO Releases Its Most Stylish and Compact Smartwatch Yet, the Watch X2 Mini.
Posted 7-Aug-2025 12:37


Epson Launches New High-End EH-LS9000B Home Theatre Laser Projector
Posted 7-Aug-2025 12:34


Air New Zealand Starts AI adoption with OpenAI
Posted 24-Jul-2025 16:00


eero Pro 7 Review
Posted 23-Jul-2025 12:07


BeeStation Plus Review
Posted 21-Jul-2025 14:21


eero Unveils New Wi-Fi 7 Products in New Zealand
Posted 21-Jul-2025 00:01


WiZ Introduces HDMI Sync Box and other Light Devices
Posted 20-Jul-2025 17:32


RedShield Enhances DDoS and Bot Attack Protection
Posted 20-Jul-2025 17:26


Seagate Ships 30TB Drives
Posted 17-Jul-2025 11:24


Oclean AirPump A10 Water Flosser Review
Posted 13-Jul-2025 11:05


Samsung Galaxy Z Fold7: Raising the Bar for Smartphones
Posted 10-Jul-2025 02:01


Samsung Galaxy Z Flip7 Brings New Edge-To-Edge FlexWindow
Posted 10-Jul-2025 02:01









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.