Full Date and Time of a given localization

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
Germaris
Forum Newbie
Posts: 2
Joined: Tue Jul 17, 2007 10:53 am

Full Date and Time of a given localization

Post by Germaris »

Hi there !

I wish to display in my Flash File (don't worry about Flash, I know how to handle PHP results and send them to Flash !) which is read all throughout the world, the Full Date and Time of my Home.

My Server is in California, I am living in Quebec (three hours of difference) and my File could be read by friends in Japan or Indi or South Africa.
Displaying the Date and Time of my Home will say to my friends, for example : "Don't phone me, I'm sleeping" !!! He he he...

I thank you very much in advance for any advice, link, or active help !!!
Paw
Forum Newbie
Posts: 20
Joined: Tue Jul 17, 2007 10:27 am

Post by Paw »

Hi there,

that sounds like a case for time arithmetics. You can use the PHP function

Code: Select all

time()
for that, which returns the number of seconds since the "Unix epoch", and add +/- 10,800 to it (depending on if Quebec's time is 3 hours behind or advanced to California's).
The result can be put into the

Code: Select all

date()
function to create a nicely formatted date-time string.
Germaris
Forum Newbie
Posts: 2
Joined: Tue Jul 17, 2007 10:53 am

Post by Germaris »

This sounds good to me and seems to be an elegant solution...
I'll give it a try and keep you informed.

Many thanks !
Post Reply