php time zone

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
lawrence_chtan
Forum Newbie
Posts: 22
Joined: Mon Jan 02, 2006 8:20 pm
Location: SINGAPORE

php time zone

Post 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
User avatar
Luke
The Ninja Space Mod
Posts: 6424
Joined: Fri Aug 05, 2005 1:53 pm
Location: Paradise, CA

Post by Luke »

date_default_timezone_set() possibly?

if not, just figure out the difference between the server time and your time and adjust accordingly.
lawrence_chtan
Forum Newbie
Posts: 22
Joined: Mon Jan 02, 2006 8:20 pm
Location: SINGAPORE

the timezone

Post 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....
Post Reply