• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
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


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


Users browsing this thread:
1 Guest(s)


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.