i need code for current date and time?

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
qumar
Forum Commoner
Posts: 29
Joined: Wed Nov 01, 2006 8:20 am

i need code for current date and time?

Post by qumar »

hi,

i need code for current date and time. I am trying this following code.

$datetime=date("d/m/y H:i:s");

But i am getting date is correctly. But time gives GTM time, means less 5.30h.
so please help to me.
Thanks.
User avatar
Mordred
DevNet Resident
Posts: 1579
Joined: Sun Sep 03, 2006 5:19 am
Location: Sofia, Bulgaria

Post by Mordred »

Try

Code: Select all

gmdate()
But it should be the other way around, gmdate() gives GMT time and date() gives local time.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

The local server time may be set to GMT. I always set my servers to UTC.
Post Reply