I guess I'm confused by the whole timezone thing and I don't want to
write a web app that gets this stuff wrong. I don't know how timezones
work exactly -- is it just hours +/- on GMT or are there going to be
minor differences on minutes and seconds too?
What I want to do is have a web app that one logs into (great place for
submitting the browser's view on time via Javascript) and then the user
sees the records from the database with dates converted from GMT to
their local timezone. The database, however, will only store GMT time
for all the records. (Imagine a simplistic, one-table helpdesk
ticketing system for the style of database to make this easy. Oh, and
I'm more a fan of PostgreSQL than MySQL.)
How do I write such a thing? Let me know. Here's my rendition, if I
have this right.
If it's only just hours, then I guess I need my L1.php (login1) page --
which submits to L2.php for processing before showing Q.php for the
helpdesk queue -- to collect the browser's view on time via Javascript.
This is then stuck in a hidden field via Javascript and that field is
submitted to L2.php. L2 reads this and compares this with gmdate('Y-m-d
H:i:s'), checking only for the difference in hours. When it knows this,
then all the records (open tickets) it finds in the database have date
math applied to be this difference in hours. Even at that, I'm not too
skilled with applying date math in PHP. I didn't find a DateAdd or
DateDiff set of functions.
I'm also a Javascript Minimalist so that this doesn't break in certain
people's browsers. That's why all I was planning to do was collect the
browser's sense of date/time and pass that to L2.php so that the
processing can be consistent, rather than rely on Javascript to get it
right.
And then there's also the issue where you have a date in one timezone,
and the the previous or next day in the other timezone, so at that
point it becomes more than just hours, but changes in days too.
write a web app that gets this stuff wrong. I don't know how timezones
work exactly -- is it just hours +/- on GMT or are there going to be
minor differences on minutes and seconds too?
What I want to do is have a web app that one logs into (great place for
submitting the browser's view on time via Javascript) and then the user
sees the records from the database with dates converted from GMT to
their local timezone. The database, however, will only store GMT time
for all the records. (Imagine a simplistic, one-table helpdesk
ticketing system for the style of database to make this easy. Oh, and
I'm more a fan of PostgreSQL than MySQL.)
How do I write such a thing? Let me know. Here's my rendition, if I
have this right.
If it's only just hours, then I guess I need my L1.php (login1) page --
which submits to L2.php for processing before showing Q.php for the
helpdesk queue -- to collect the browser's view on time via Javascript.
This is then stuck in a hidden field via Javascript and that field is
submitted to L2.php. L2 reads this and compares this with gmdate('Y-m-d
H:i:s'), checking only for the difference in hours. When it knows this,
then all the records (open tickets) it finds in the database have date
math applied to be this difference in hours. Even at that, I'm not too
skilled with applying date math in PHP. I didn't find a DateAdd or
DateDiff set of functions.
I'm also a Javascript Minimalist so that this doesn't break in certain
people's browsers. That's why all I was planning to do was collect the
browser's sense of date/time and pass that to L2.php so that the
processing can be consistent, rather than rely on Javascript to get it
right.
And then there's also the issue where you have a date in one timezone,
and the the previous or next day in the other timezone, so at that
point it becomes more than just hours, but changes in days too.
Comment