Yeodan Posted May 23, 2009 Share Posted May 23, 2009 what's the easiest way to do this? in one spot I need to add 20 seconds to the current time in another spot I need to add 2 minutes to the current time the easiest method seems to be date() + 20 but I'm not sure wether that'll work, probably not $date = mktime(date("H"), date("i"), date("s") + 20, date("m"), date("d"), date("y"); I need to compare $date to a mysql timestamp, so I'm not sure wich format to use or even wether I should use a timestamp in my mysql database or some other format there too the purpose of the function is to check wether the date + added time has already passed or not, so I need a full date, not just the time Quote Link to comment https://forums.phpfreaks.com/topic/159378-solved-adding-seconds-minutes-to-a-date/ Share on other sites More sharing options...
MadTechie Posted May 23, 2009 Share Posted May 23, 2009 Heres an easy options pull the datetime out a unix (same format as time()) SELECT myDate, UNIX_TIMESTAMP(myDate) as myUnixDate FROM table etc etc your see that myDate is 2009-05-23 14:27:57 but myUnixDate is 1243085277 so you can still you the + 20 etc Quote Link to comment https://forums.phpfreaks.com/topic/159378-solved-adding-seconds-minutes-to-a-date/#findComment-840675 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.