Just found this: http://www.anicon.ca/timezone-script.php... perfect, but it's 24K!
Could a friendly soul hack it so that it simply outputs the NY time, without any of the dropdown stuff, or the mysql table?
That would make my day :-)
While I can't remember it at the moment, I do recall there's a php global which explicitly placed the machines time into said timezone w/dst and output a nice timestamp. I'll have to remember what it was tho.
I try :) But Hmm, the only other alternative solution then would be possible is by weeding out how php comes about to determine the environment variables in the same way putenv does (not fun unless you're a masochist). The only other solution I can offer, is find what dates DST runs through in the US. Then just calculate the offset from there. You're only doing New York so it's obviously eastern time which durring winter falls back 1 hour then in the spring, it jumps forward 1.
Hey thanks for all your help dude, much appreciated :D
I've got it working ok using that other script... http://www.thirdeyedesign.co.uk/beta/thirdeyedesign_new/timezone2.php
haha, yeah, don't get me started on attempting to perform dynamic offsets via php and mapping it all. I had one hell of a week just toying with that in my spare time it drove me nuts. And people thing my going bald is a result of genetic disposition...
Comments
I'm finding the time via a php timestamp:
<?php $timestamp = explode(" ",microtime()); $timestamp = round(($timestamp[1] + $timestamp[0])*1000); // GMT server timestamp in milliseconds ?>
This is then fed into Flash as is for the UK time, and -5hrs for the NY time.
From here in the UK this works perfectly, but when viewed from the US, the NY time is somehow pushed back another hour (-6hrs from UK time).
putenv("TZ=US/Central");
http://us3.php.net/putenv