Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Adding 1 Hour to Current Time Using Date Function 2

Status
Not open for further replies.

tyhand

Programmer
Jul 3, 2002
186
US
Hey all,

How can I add 1 hour to the current time in PHP?

I'm using the date function.

Example:

$omydate = date("Y-m-d H:i:s");

What I want to do is add 1 hour to the "H". So whenever the code parses the date, it will always be the current time plus 1 hour. If current time is 14:25:30, I want it to read 15:23:30.

How can I accomplish this?

Thanks!

- Tyhand.

 
or using strtotime (one of my fave php functions)...

Code:
echo date("Y-m-d H:i:s", strtotime ("+1 hour"));
 

Thanks fellas!

Both work like a charm.

- tyhand
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top