poacher Posted July 11, 2008 Share Posted July 11, 2008 Hello friends, this is my first ques here. I need to test a script that uses unix timestamp with time() function. I need to test the out come of the logic for the next day. hence I need to changed the code that uses my function instead to time() to provide tomorrow's timestamp. Here is what I wrote and is not working. Since Im new to php, i need your help:- filename = qa_time1.php <?php function qa_time1(){ $current_time = time(); return $current_time; } qa_time1(); ?> Link to comment https://forums.phpfreaks.com/topic/114342-script-having-function-to-return-unix-timestamp-for-next-day/ Share on other sites More sharing options...
kenrbnsn Posted July 11, 2008 Share Posted July 11, 2008 Use the strtotime() function <?php function qa_time1() { return (strtotime('tomorrow')); }?> Ken Link to comment https://forums.phpfreaks.com/topic/114342-script-having-function-to-return-unix-timestamp-for-next-day/#findComment-588022 Share on other sites More sharing options...
discomatt Posted July 11, 2008 Share Posted July 11, 2008 I think the above example is "better" but here's another way, just so you learn a bit about manipulating timestamps.. $tomorrow = time() + ( 60 * 60 * 24 ); # 60 seconds * 60 minutes * 24 hours Link to comment https://forums.phpfreaks.com/topic/114342-script-having-function-to-return-unix-timestamp-for-next-day/#findComment-588027 Share on other sites More sharing options...
chronister Posted July 12, 2008 Share Posted July 12, 2008 <?php $tomorrow = mktime(date('H'),date('i'),date('s'),date('m'),date('d')+1,date('y')); ?> This will give you right now 1 day later. This is another way of manipulating dates and times. Link to comment https://forums.phpfreaks.com/topic/114342-script-having-function-to-return-unix-timestamp-for-next-day/#findComment-588189 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.