logo
Apache Lounge
Webmasters

 

About Forum Index Downloads Search Register Log in RSS X


Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.

or

Bitcoin

A donation makes a contribution towards the costs, the time and effort that's going in this site and building.

Thank You! Steffen

Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
Post new topic   Forum Index -> Coding & Scripting Corner View previous topic :: View next topic
Reply to topic   Topic: Setting the timezone in php?
Author
kr33



Joined: 19 Sep 2006
Posts: 64
Location: South Africa

PostPosted: Mon 30 Oct '06 17:00    Post subject: Setting the timezone in php? Reply with quote

Hi,

I'm trying to get the date and time in php, for keeping logs, for security in my login pages etc.

I can get the date and time with no problems, but the timezone is all off and my server timezone is correct, i'm using Windows Server 2003 and php5 installed on IIS 6.

My time zone is actually GMT +02:00 but my php script shows EEST +0300
Why? and how do I correct this?

Thanks
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7371
Location: Germany, Next to Hamburg

PostPosted: Mon 30 Oct '06 17:32    Post subject: Reply with quote

$tz="Europe/Berlin";
//set you locale timezone see http://www.php.net/manual/timezones.php


//only needed if you use PHP 5.1.x or greater
if(0 < version_compare(PHP_VERSION, '5.1.0')){
date_default_timezone_set($tz);
}
Back to top


Reply to topic   Topic: Setting the timezone in php? View previous topic :: View next topic
Post new topic   Forum Index -> Coding & Scripting Corner