Welcome Guest, Not a member yet? Register   Sign In
"24 hours ago" in Unix
#1

[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?
#2

[eluser]Colin Williams[/eluser]
Just a little 3rd grade math.

Code:
$one_day_ago = time() - (60 * 60 * 24);
#3

[eluser]danmontgomery[/eluser]
Or, for the lazy:

Code:
$yesterday = strtotime("24 hours ago");

http://php.net/manual/en/function.strtotime.php
#4

[eluser]Colin Williams[/eluser]
strtotime('-1d') might work too.




Theme © iAndrew 2016 - Forum software by © MyBB