Jump to content
xisto Community
Sign in to follow this  
leiaah

Question About The Date() Function In Php

Recommended Posts

Hi this is the code I've been using. This works perfectly fine with mysql but I'm having trouble with getting the exact time. It probably has something to do with time zones and countries. Is there something that I need to set to get the time right? I'm from the Philippines and we have the same time as Singapore and HongKong. Help please. Tnx. :o

$date = date('H:i A, jS F Y');

Share this post


Link to post
Share on other sites

One thing you can do (that I did, and it worked) is to change the offset (actually I think it's the only thing you can do). Figure out what time the server is at with just a simple date showing the hour/minute. Something like:

date("H:i")
Then, find your time (just look at a clock). Where I am, the difference is 3 hours. Then convert the difference to seconds (hours*3600). To make it change the time in the date function, add this optional parameter:
date("H:i",time()+thedifference)ORdate("H:i",time()-thedifference) //In the case that you're behind the server, I don't know what timezone you're in
You can do a test or two with the other date things to make sure it's right.

Share this post


Link to post
Share on other sites

One thing you can do (that I did, and it worked) is to change the offset (actually I think it's the only thing you can do). Figure out what time the server is at with just a simple date showing the hour/minute. Something like:

date("H:i")
Then, find your time (just look at a clock). Where I am, the difference is 3 hours. Then convert the difference to seconds (hours*3600). To make it change the time in the date function, add this optional parameter:
date("H:i",time()+thedifference)ORdate("H:i",time()-thedifference) //In the case that you're behind the server, I don't know what timezone you're in
You can do a test or two with the other date things to make sure it's right.

129738[/snapback]


Thanks beeseven! The time is plus 15 here! Very cool!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.