Hi,
I'm a newbie here and reletivly new to php, i hope any of you can help.
What im wanting to do is show two times on a web page. The first time is the time that is taken from the server with the date() function, the second is a calculated time. (ie. calculating the time of one country from the server time of the other).
Can anyone suggest some PHP code to take the time from the server and add 5 hours to it while still displaying the proper AM or PM and reseting the hour back to 1 oclock after it go's past 12 oclock. The date dunction that im using is date(g:i A) to show eg. "3:45 PM".
If anybody could help, that would be great.
Cheers...Nickuss.
Adding/Calculating time with php.
Moderator: General Moderators
- Derfel Cadarn
- Forum Contributor
- Posts: 193
- Joined: Thu Jul 17, 2003 12:02 pm
- Location: Berlin, Germany
Before asking others to code for you. I'd suggest you read time and date functions in the php-manual. You could play a bit with those?!? 
Definitely look at the php manual. One piece of advice I can give you is do all your adding/subtracting to the UNIX timestamp, rather than a prettily formatted date. It's much easier to work with and you don't have to worry about noon/midnight rollovers.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.