It is impossible to know what timezone a user is in from their dst offset alone.
It should also be possible to choose any timezone we support whenever timezone choice is presented.

Oleg wrote:It is impossible to know what timezone a user is in from their dst offset alone.
It should also be possible to choose any timezone we support whenever timezone choice is presented.
"Wed Aug 24 2011 08:41:41 GMT+0100 (BST)"

<script type="text/javascript">
var d = new Date()
var gmtHours = -d.getTimezoneOffset()/60;
for (var i=0;i<document.getElementById("timezone").options.length;i++) {
if (document.getElementById("timezone").options[i].value == gmtHours)
document.getElementById("timezone").options[i].selected = true;
}
</script> 
if (d.toString().indexOf("Daylight")!=-1) gmtHours--;Noxwizard wrote:It does not correctly take DST into account. So UTC-5 EST was selected instead of UTC-6 CST w/DST.
Thu Aug 25 2011 02:06:02 GMT-0500 (Central Daylight Time)Thu Aug 25 02:06:02 CDT 2011
Noxwizard wrote:The output varies by browser, so that won't really work. Additionally, I don't know if browsers localize those strings or not.
Chrome:
- Code: Select all
Thu Aug 25 2011 02:06:02 GMT-0500 (Central Daylight Time)
IE:
- Code: Select all
Thu Aug 25 02:06:02 CDT 2011
"Thu Aug 25 2011 19:54:00 GMT+0100 (BST)"


callumacrae wrote:new Date().toString() is, according to DavidIQ, standardised across all browsers:"Thu Aug 25 2011 19:54:00 GMT+0100 (BST)"

.toString() = Fri Aug 26 2011 00:09:29 GMT+0200 (Mitteleuropäische Sommerzeit)
.toUTCString() = Thu, 25 Aug 2011 22:09:29 GMT
.getTimezoneOffset() = -120.toString() = Fri Aug 26 2011 00:09:34 GMT+0200
.toUTCString() = Thu, 25 Aug 2011 22:09:34 GMT
.getTimezoneOffset() = -120
Return to [3.1/Ascraeus] Merged RFCs
Users browsing this forum: No registered users and 7 guests