Page 1 of 2

Timezone testing on my website

Posted: Sat 06 Jul 2013 6:50 am
by DaveNZ
Hi all,

I need some visitors from different time zones to look at a page on my site. I've altered my time calculations for my graphs and I only know that it is correct for the local time zone. I suspect I need to add a timezone adjustment to my calculations but want to collect some data first to make sure I do it right.

Please copy and paste the data you see in the yellow table here.

For me, it currently shows
Theoretical start ... 18:40
Actual start ........ 18:40
Your GMT offset ..... GMT +12

Note this is just a test page, it will eventually disappear from the website.
Thanks in advance!

The page is <edit - url of test page removed>.

Re: Timezone testing on my website

Posted: Sat 06 Jul 2013 7:54 am
by laulau
From France:

Theoretical start ... 19:45
Actual start ........ 9:45
Your GMT offset ..... GMT +2

Re: Timezone testing on my website

Posted: Sat 06 Jul 2013 8:08 am
by steve
UK, currently on daylight savings:

Theoretical start ... 20:00
Actual start ........ 9:0
Your GMT offset ..... GMT +1

Re: Timezone testing on my website

Posted: Sat 06 Jul 2013 8:16 am
by DaveNZ
steve wrote:UK, currently on daylight savings:

Theoretical start ... 20:00
Actual start ........ 9:0
Your GMT offset ..... GMT +1
Oops, looks like I forgot to adjust minutes to always be 2 figures.

Thanks Laurent & Steve. It looks like I need to do an (NZ offset - local offset) adjustment

Re: Timezone testing on my website

Posted: Sat 06 Jul 2013 8:22 am
by water01
UK


Theoretical start ... 20:10
Actual start ........ 9:10
Your GMT offset ..... GMT +1

Re: Timezone testing on my website

Posted: Sat 06 Jul 2013 8:30 am
by weatherfrog80
Germany,

I got the following:

Theoretical start ... 20:20
Actual start ........ 10:20
Your GMT offset ..... GMT +2

Re: Timezone testing on my website

Posted: Sat 06 Jul 2013 9:19 am
by Matt.j5b
Brisbane, East Coast of Australia, (Australian Eastern Standard Time)

Theoretical start ... 21:10
Actual start ........ 19:10
Your GMT offset ..... GMT +10

Re: Timezone testing on my website

Posted: Sat 06 Jul 2013 11:26 am
by DaveNZ
After literally pulling my hair out over this stuff... I reprogrammed it another way.
Was hard enough getting dates/times/DST done right in PHP, let alone getting in right in javascript across all timezones.

Please check the page again, it should be matching up now
http://howickweather.info/graphsTEST.php

Re: Timezone testing on my website

Posted: Sat 06 Jul 2013 11:57 am
by tobyspond
Concord, Massachusetts, East Coast USA, eastern time zone (daylight savings time)

Theoretical start 23:45
Actual start 23:45
GMT offset GMT-4

Re: Timezone testing on my website

Posted: Sat 06 Jul 2013 1:01 pm
by steve
Theoretical start ... 00:50
Actual start ........ 00:50
Your GMT offset ..... GMT +1

Re: Timezone testing on my website

Posted: Sat 06 Jul 2013 3:46 pm
by beteljuice
If the page is generated by php why are you using JS to 'work' TimeZones ?

If you are using the 'date' plot of HighCharts just use php to set dates to unix / JS epoch and it will look the same to everyone.

php

Code: Select all

......

date_default_timezone_set('Pacific/Auckland'); // DO NOT CHANGE

.... data grab and prepare loop

// generate unix timestamps $m = month, $x = date, $y = year but YOU want to also use hours, mins
$epoch = mktime(0, 0, 0, $m, $x, $y) *1000; // *1000 because of the difference between php and JS 'count'

// generate string for graph data
$t_data .= "[" .$epoch. "," .($temperatue *1). "],";

... end loop

Neat coding BTW :clap:

Re: Timezone testing on my website

Posted: Sat 06 Jul 2013 3:58 pm
by mikkimii
From Finland, EEST – Eastern European Summer Time

Theoretical start ... 03:45
Actual start ........ 03:45
Your GMT offset ..... GMT +3

Re: Timezone testing on my website

Posted: Sat 06 Jul 2013 5:44 pm
by gluepack
From Bulgaria - EEST (GMT +3)

Theoretical start ... 05:25
Actual start ........ 05:25
Your GMT offset ..... GMT +3

Very nicely presented. How much? ;)
it will eventually disappear from the website
What do you mean?

@mikkimii Mika - your signature banner link fails (oh, you missed the : prior to the //)

Re: Timezone testing on my website

Posted: Sat 06 Jul 2013 8:06 pm
by mikkimii
gluepack wrote:@mikkimii Mika - your signature banner link fails (oh, you missed the : prior to the //)
Thank you for noticing, now signature link works. I had two http:// 's in URL :oops:

Re: Timezone testing on my website

Posted: Sat 06 Jul 2013 8:33 pm
by DaveNZ
beteljuice wrote:If the page is generated by php why are you using JS to 'work' TimeZones ?

If you are using the 'date' plot of HighCharts just use php to set dates to unix / JS epoch and it will look the same to everyone.

php

Code: Select all

......

date_default_timezone_set('Pacific/Auckland'); // DO NOT CHANGE

.... data grab and prepare loop

// generate unix timestamps $m = month, $x = date, $y = year but YOU want to also use hours, mins
$epoch = mktime(0, 0, 0, $m, $x, $y) *1000; // *1000 because of the difference between php and JS 'count'

// generate string for graph data
$t_data .= "[" .$epoch. "," .($temperatue *1). "],";

... end loop

Neat coding BTW :clap:
I wanted to handle cases of when DST starts and ends in New Zealand. I used to present my graphs using UTC times and display a tooltip based on the user's local timezone offset, but this results in a discontinuous graph when my data suddenly jumps from 2am to 3am (DST start) and from 3am back to 2am (DST end).

Might seem very minor but I really wanted to handle these cases as continuous data.