"24 hours ago" in Unix - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21) +--- Thread: "24 hours ago" in Unix (/showthread.php?tid=27082) |
"24 hours ago" in Unix - El Forum - 01-31-2010 [eluser]ShoeLace1291[/eluser] I need to be able to get what the date and time would have been 24 hours from the current time displayed in a unix. How do I do this in code igniter? "24 hours ago" in Unix - El Forum - 01-31-2010 [eluser]Colin Williams[/eluser] Just a little 3rd grade math. Code: $one_day_ago = time() - (60 * 60 * 24); "24 hours ago" in Unix - El Forum - 02-01-2010 [eluser]danmontgomery[/eluser] Or, for the lazy: Code: $yesterday = strtotime("24 hours ago"); http://php.net/manual/en/function.strtotime.php "24 hours ago" in Unix - El Forum - 02-01-2010 [eluser]Colin Williams[/eluser] strtotime('-1d') might work too. |