Incrementing a datetime in PHP
May 12, 2011 6:25 PM Subscribe
How can I increment a mySQL datetime in PHP?
posted by ofcourseican to computers & internet (9 answers total) 1 user marked this as a favorite
I need to be able to increment a mySQL datetime formatted timestamp in my PHP code. In this specific situation, with every iteration of my loop, I need to increment a timestamp by one hour.
So, for example, if it starts as "2011-01-01 00:00:00" then on the next iteration of my loop it needs to read "2011-01-01 01:00:00". What can I add/do to the datetime in each loop to make it one hour larger (and so, when it goes from 23:00:00 to 00:00:00, it goes to the next date, too!)
Any help is appreciated!