ShoeLace1291 Posted February 1, 2010 Share Posted February 1, 2010 I need to find what the date would have been 24 hours before the current time in unix. HOw would I do this? Quote Link to comment https://forums.phpfreaks.com/topic/190498-24-hours-ago-in-unix/ Share on other sites More sharing options...
premiso Posted February 1, 2010 Share Posted February 1, 2010 echo date('h:i', time()-60*60*24); That is one way to do it. (Given that I did the h:i right). Quote Link to comment https://forums.phpfreaks.com/topic/190498-24-hours-ago-in-unix/#findComment-1004842 Share on other sites More sharing options...
ShoeLace1291 Posted February 1, 2010 Author Share Posted February 1, 2010 Ok, so that just displays the actual date. I just need to get the unix time stamp from that and how I'm doing it works fine on my machine(xampp), but when I upload it to my web server, I get the following error Parse error: syntax error, unexpected T_LNUMBER, expecting T_VARIABLE or '$' in /nfs/c03/h05/mnt/81715/domains/sidefxgaming.com/html/dev/system/application/models/sponsor.php on line 13 This is line 13: $24hoursago = time()-60*60*23; I get the same thing when I use your code. Quote Link to comment https://forums.phpfreaks.com/topic/190498-24-hours-ago-in-unix/#findComment-1004846 Share on other sites More sharing options...
Alex Posted February 1, 2010 Share Posted February 1, 2010 Variable names cannot begin with numbers. Quote Link to comment https://forums.phpfreaks.com/topic/190498-24-hours-ago-in-unix/#findComment-1004849 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.