|
|
|
|
![]() ![]() |
Apr 16 2005, 01:23 AM
Post
#1
|
|
|
Super Member ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 436 Joined: 21-January 05 From: Koronadal City, Philippines Member No.: 3,358 |
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.
CODE $date = date('H:i A, jS F Y');
|
|
|
|
Apr 16 2005, 02:31 AM
Post
#2
|
|
|
Privileged Member ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 629 Joined: 26-February 05 Member No.: 3,995 |
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:
CODE 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:CODE date("H:i",time()+thedifference) You can do a test or two with the other date things to make sure it's right.
OR date("H:i",time()-thedifference) //In the case that you're behind the server, I don't know what timezone you're in |
|
|
|
Apr 16 2005, 11:07 AM
Post
#3
|
|
|
Advanced Member ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 113 Joined: 14-January 05 From: Philippines Member No.: 3,271 |
have you ever tried this?
CODE gmdate('H:i A, jS F Y', time());
|
|
|
|
Apr 16 2005, 05:00 PM
Post
#4
|
|
|
Privileged Member ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 629 Joined: 26-February 05 Member No.: 3,995 |
QUOTE(mobious @ Apr 16 2005, 06:07 AM) That would just return the server's time, which isn't necessarily the desired time. |
|
|
|
Apr 18 2005, 01:01 AM
Post
#5
|
|
|
Super Member ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 436 Joined: 21-January 05 From: Koronadal City, Philippines Member No.: 3,358 |
QUOTE(beeseven @ Apr 16 2005, 10:31 AM) 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: CODE 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:CODE date("H:i",time()+thedifference) You can do a test or two with the other date things to make sure it's right.OR date("H:i",time()-thedifference) //In the case that you're behind the server, I don't know what timezone you're in Thanks beeseven! The time is plus 15 here! Very cool! |
|
|
|
![]() ![]() |
Similar Topics
|
Lo-Fi Version | Time is now: 12th October 2008 - 07:23 AM |