date ()

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
thoughtriot
Forum Commoner
Posts: 26
Joined: Thu Nov 07, 2002 9:32 pm

date ()

Post by thoughtriot »

I'm using the date () function for a news script, and I'm doing date ("m.d.y h:i a") and the hour is 3 ahead of mine because it's using the wrong time zone. How would I make it -3 hours?
User avatar
BigE
Site Admin
Posts: 139
Joined: Fri Apr 19, 2002 9:49 am
Location: Missouri, USA
Contact:

Post by BigE »

date() has a nifty little function where you can specify a timestamp for it to create a date uppon. This should work for you.

Code: Select all

date ("m.d.y h:i a", time() -10800);
What that does is use time() to take the current time then subtracts 10800 seconds from the current timestamp which will give you a timestamp that is 3 hours earlier. Hope that helps.
Post Reply