12

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

4
  • what is the php version on live server Commented Jun 8, 2011 at 7:41
  • What does $date look like? And did you mean UTC instead of UCT? Commented Jun 8, 2011 at 7:42
  • 3
    Does <?php print strtotime($date." UTC"); ?> work? Commented Jun 8, 2011 at 7:42
  • @Roshan 5.2.6 @Yes, typo corrected. $date = 2011-05-25 05:48:00 Commented Jun 8, 2011 at 7:51

2 Answers 2

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

instead of

<?php print strtotime($date." UCT"); ?> 
Sign up to request clarification or add additional context in comments.

2 Comments

@stefgosselin UCT is also valid timezone . php.net/manual/en/timezones.others.php
Please do not use any of the timezones listed here (besides UTC), they only exist for backward compatible reasons.
0

PHP warning on PHP documentation page, no support for UCT there :

http://www.php.net/manual/en/timezones.others.php

Warning

Please do not use any of the timezones listed here (besides UTC), they only exist for backward compatible reasons.

And here is latest PECL timezon database :

http://pecl.php.net/get/timezonedb

2 Comments

Blatantly not pointing out that the @Good-bye likely made a typo is rude.
@capikaw Or may be because it was not a typo, UCT is a supported name for "Universal Coordinated Time" , but is not supported in PHP , and that is what I had mentioned in my answer. See linux for example : ` ls /usr/share/zoneinfo/U* /usr/share/zoneinfo/UCT /usr/share/zoneinfo/Universal /usr/share/zoneinfo/UTC` A misinformed downvote is also rude IMHO.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.