Date() function showing the wrong time.

Ask about a PHP problem here.
Post Reply
User avatar
Temor
Posts: 1186
Joined: Thu May 05, 2011 8:04 pm

Date() function showing the wrong time.

Post by Temor »

So, my server is being hosted in a different timezone ( 2 hours difference ) and I use the date() function to insert the time into a database for a blog, but it shows the servers current time, and that tends to be quite irritating... Is there any way to insert MY current time into the database instead of the servers?

:)
User avatar
jacek
Site Admin
Posts: 3262
Joined: Thu May 05, 2011 1:45 pm
Location: UK
Contact:

Re: Date() function showing the wrong time.

Post by jacek »

You can set the timezone with date_default_timezone_set(), for a list see http://www.php.net/manual/en/timezones.php
Image
User avatar
Temor
Posts: 1186
Joined: Thu May 05, 2011 8:04 pm

Re: Date() function showing the wrong time.

Post by Temor »

jacek wrote:You can set the timezone with date_default_timezone_set(), for a list see http://www.php.net/manual/en/timezones.php
alright, thank you :)
Post Reply