Pain Posted February 6, 2013 Share Posted February 6, 2013 Hello. I am trying to create time in the future. <?php $time_in_minutes = (round($time / 60)); $future_time = date("H:i:s",time() + 60 * $time_in_minutes); ?> It all works. I get something like "15:58:28". Now if i want to insert this record into the database, which type should i pick? DATETIME or TIMESTAMP? Note that i want to check whether the current time has now passed the future time. Thanks:) Link to comment https://forums.phpfreaks.com/topic/274108-php-time-in-the-future/ Share on other sites More sharing options...
Christian F. Posted February 6, 2013 Share Posted February 6, 2013 Why not just the DateTime class with a relative time format? $time = new DateTime ('+1 hour'); This has the added benefit of dealing with not only midnight automatically, but also leap seconds. In any case, I'd go for a TIME field for this. Since you're only storing the time. Link to comment https://forums.phpfreaks.com/topic/274108-php-time-in-the-future/#findComment-1410465 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.