tfburges Posted July 14, 2008 Share Posted July 14, 2008 I've done a bit of searching on the net but all that seems to come up is timestamp conversion. I figure it would be quicker to ask here since the results google gives me vary quite a bit. I'd like to have a timestamp for each time a user submits data through a form. Should I create a new column in the table and have a hidden input field in the form? I'm sure there's a simpler command for this out there somewhere. Link to comment https://forums.phpfreaks.com/topic/114677-quick-question-about-timestamps/ Share on other sites More sharing options...
ChadNomad Posted July 14, 2008 Share Posted July 14, 2008 Use the time() and date() functions and store it in a column. <?php $nextWeek = time() + (7 * 24 * 60 * 60); // 7 days; 24 hours; 60 mins; 60secs echo 'Now: '. date('Y-m-d') ."\n"; echo 'Next Week: '. date('Y-m-d', $nextWeek) ."\n"; // or using strtotime(): echo 'Next Week: '. date('Y-m-d', strtotime('+1 week')) ."\n"; ?> http://uk.php.net/time Edit: Use the time function to create a timestamp like 1211287800 and the date function to format the string. Link to comment https://forums.phpfreaks.com/topic/114677-quick-question-about-timestamps/#findComment-589715 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.