...

View Full Version : PHP timezone question



kosaic
03-21-2010, 10:33 PM
Hi,

Beginner question ... I have the following code:



$todayis = date("l, F j, Y, g:i a") ;


It produces the following:
Sunday, March 21, 2010, 3:28 pm

Which is great, but it is in CST (America) and I need it in AST (Canada)

So I need it to show 2 hours ahead of what it is showing now.

Any simple fix ?

thanks

MattF
03-21-2010, 10:34 PM
$todayis = date("l, F j, Y, g:i a", (time()+7200));

kosaic
03-21-2010, 10:58 PM
Thanks VERY much ... I fiddled with this for a while but couldnt get it right.

Works perfectly.

Cheers,
k

Len Whistler
03-22-2010, 01:28 AM
Or:

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

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



<?php
date_default_timezone_set('America/St_Johns');
echo date('D,F j, Y, h:i:s A');
?>

EDIT: After a quick look through the first link Canada/Eastern might be better than America/St_Johns. It's listed under "Others".





--------



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum