Page 1 of 1

php time zone

Posted: Fri Jan 19, 2007 1:32 am
by lawrence_chtan
Greeting Guru on PHP

I notice when i put in the function

Code: Select all

<?php
// assume now is 2007 01 19 Friday 15:20:38
$currentdatetime=date('d-m-Y D H:i:s')

echo $currentdatetime;
?>
It will display

19-01-2006 Fri 07:20:38

seems like is the locale issue.

how do i fix that? thanks in advance

Posted: Fri Jan 19, 2007 1:43 am
by Luke
date_default_timezone_set() possibly?

if not, just figure out the difference between the server time and your time and adjust accordingly.

the timezone

Posted: Fri Jan 19, 2007 2:37 am
by lawrence_chtan
Hi

thanks for your great help. It works

Code: Select all

<?php
date_default_timezone_set('Asia/Singapore') ;
$data=date('h:i:s');

echo $data;

?>
GMT+8 show....