Welcome Guest, Not a member yet? Register   Sign In
Howto; Date of x-days ago
#1

[eluser]freshface[/eluser]
Hey

I want the data of x dags ago (26 days).
How do I do this? pseudo: $currentdate = date("Y-m-d") - 26;

Any thoughts?

Thx
#2

[eluser]Pascal Kriete[/eluser]
Two that immediately come to mind:
Code:
$option_one = strtotime("-26 days");
$option_two = time() - 60 * 60 * 24 * 26

That'll give you the timestamp, and then use another function (date()) to format it.
#3

[eluser]mironcho[/eluser]
Hi,
one way to achieve this is by setting the second argument of the date() function, which must be some unix timestamp:
Code:
$olddate = time() - (26 * 86400);
$currentdate = date("Y-m-d", $olddate);


edit: Inparo was faster then me Smile
#4

[eluser]freshface[/eluser]
Nive guys, thx.
Easier then I thought




Theme © iAndrew 2016 - Forum software by © MyBB