Vanilla 1 is no longer supported or maintained. If you need a copy, you can get it here.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

Stupid php date question (new problems!)

13»

Comments

  • 3stripe3stripe ✭✭
    edited February 2006
    Woaah sorry for the confusion :-?!!!

    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).
  • 3stripe3stripe ✭✭
    edited February 2006
    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.
  • putenv("TZ=US/Central");

    http://us3.php.net/putenv
  • Holy moly Lech, thank you very much. (I've managed to cut the script down to 7K so might still use that...)
  • Can't use putenv, safe mode is enabled :-(
  • lechlech
    edited February 2006
    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
  • Nice, I just hope it can migrate to non-DST hours when the time comes for you :)
  • can't believe what a headache this has been. "yeah, just stick a couple of clocks on the homepage with the 2 times on them, won't be hard"
  • 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...
This discussion has been closed.