phptimestampstrtotime

PHP strtotime to return as UTC timestamp?


Its a bit of a sever difference problem. On my local dev. server Im using:

<?php print strtotime($date." UCT"); ?>

The above code gives me the correct timestamp for my timezone. HOWEVER, the same code returns false on the live server.

The live server has a lower version of php installed and I imagine that to be the problem.

What I'm looking for is an alternative to the above line of code.

I could use the normal strototime without the ." UCT" part and add in 2hours but would rather have PHP handle timezones.

$date looks like this: 2011-05-25 05:48:00


Solution

  • <?php print strtotime($date." UTC"); ?>
    

    instead of

    <?php print strtotime($date." UCT"); ?>