php_begins Posted September 15, 2011 Share Posted September 15, 2011 I have to two variables $cronlast and $cronnow in my php code. I need to have the time 7am of previous day in $cronlast variable and 7am today in $cronnow variable. I need the time in UNIX timestamp format. So everyday when I print the variable I should have: $cronlast=7am Yesterday(in Unix Timestamp) $cronnow=7am Today(in Unix Timestamp) I would appreciate any help. Quote Link to comment https://forums.phpfreaks.com/topic/247208-print-time-yesteraday-7am-and-today-7am-in-unix-timestamp/ Share on other sites More sharing options...
php_begins Posted September 15, 2011 Author Share Posted September 15, 2011 never mind.. this is wat i did: $cronlast = strtotime( 'yesterday 7:00 AM' ); $cronnow = strtotime( 'today 7:00 AM' ); Quote Link to comment https://forums.phpfreaks.com/topic/247208-print-time-yesteraday-7am-and-today-7am-in-unix-timestamp/#findComment-1269627 Share on other sites More sharing options...
voip03 Posted September 15, 2011 Share Posted September 15, 2011 echo date('Y-m-d', strtotime('last day')) . ' 07:00AM'; echo "<br/>"; echo date('Y-m-d', strtotime('+1 day')) . ' 07:00AM'; http://www.phpfreaks.com/forums/index.php?topic=343844.msg1622588#msg1622588 Quote Link to comment https://forums.phpfreaks.com/topic/247208-print-time-yesteraday-7am-and-today-7am-in-unix-timestamp/#findComment-1269628 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.