Time-Zone juggling



I have a PostgreSQL database chockful of datatype:
"time without time zone"

The times I chucked in there are, like, '7:00 PM' and they all seem
fine...

Until I start trying to generate an RFC 882 datetime stamp. :-(

At that point, the fact that the server lives in Portland OR, and my
times are all based in Chicago means that my output is:
Mon, 03 Apr 2006 17:00:00 PDT
even though the actual date/time in question is REALLY at 20:00 in
Chicago.

I'm just doing the naive:
select whatdate, whattime from ...
list($y, $m, $d) = explode('-', $whatdate);
list($h, $i, $s) = explode(':', $whattime);
$datetime_882 = date(DATE_RFC882, mktime($h, $i, $s, $m, $d, $y));

This is PHP4, and I've done an if(!defined()) define() to get the
DATE_RFC882 constant.

What is the least-stupid way to fix this, and get 20:00 in the
Portland OR server to turn into:
Mon, 03 Apr 2006 20:00:00 CDT
which is what time it really was.

Errrr. Without changing the schema which means having to re-do
everything else in the application. That's probably the RIGHT way to
fix it, but that ain't happening.

I've been dinking with gmmktime() and reading about setlocale() but
none of them seem to be the Right Answer.

I got a couple stupid ways I think I could fix it, and I'd rather not
do those, cuz they're stupid. :-)
E.g., str_replace(array('PDT', 'PST'), array('CDT', 'CST'), $datetime);

This time zone stuff always gets me head all spun around, I admit freely.

--
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?
.



Relevant Pages

  • Re: General Obamas Chicago War Zone
    ... In the last six months 292 killed in Chicago, ... Sens. Barack Obama & Dick Durbin, Rep. Jesse Jackson Jr., Gov. ... It seems clear to me that Obama can't fix anything. ... really stupid, but then you're the master of stupidity ...
    (soc.retirement)
  • Re: General Obamas Chicago War Zone
    ... In the last six months 292 killed in Chicago, ... Sens. Barack Obama & Dick Durbin, Rep. Jesse Jackson Jr., Gov. ... It seems clear to me that Obama can't fix anything. ... really stupid, but then you're the master of stupidity ...
    (soc.retirement)
  • Re: Daylight Savings Time
    ... I ran the cab file I found here to fix the time zone issue. ... Ran a registry save. ...
    (microsoft.public.dotnet.framework.compactframework)
  • Re: Apponitment timings when changing time zones
    ... Time based on GMT is not stupid. ... less or shift to Visiting Time Zone, enter the appointment and shift back to ... If you email me for a chat at 10 AM your time... ... > Pocket Windows 2003 calendar that changes the timings of calendar entries ...
    (microsoft.public.pocketpc)
  • Re: Time Zone Help
    ... Thanks for all your help but nothing seems to work...i ran the sfc and it ... > Insert your Windows XP Installation CD, then close it if it autoplays. ... >> to change the time zone it only displays one time zone which is GMT, ... >> give me the hot fix i needed...if you can suggest anything else, ...
    (microsoft.public.windowsxp.help_and_support)