Page 1 of 1

How to use php set date equate?

Posted: Wed Oct 27, 2004 10:15 pm
by kennie1112
Dear all,

How to use php set date equate?

e.g.
$cal_date = date("Ymd") - 14; // 14 <--- 14 Days

I think give me result is "20041014"...but it get me result is 1990...why?

I want to use today - 14days or above only...How to I do?

Who people tell me why... :cry:

Posted: Thu Oct 28, 2004 1:26 am
by m3mn0n
Check out http://www.php.net/date

They have good examples of all types of date formats there. :)

Posted: Thu Oct 28, 2004 1:37 am
by kennie1112
Sorry...I already to seem it...
but I don't understand how to use this function...
Can help me how to I do...? :cry:

Posted: Thu Oct 28, 2004 1:54 am
by timvw
for me, the easiest is

Code: Select all

strtotime("now -14 days");

Posted: Thu Oct 28, 2004 2:59 am
by kennie1112
I already test it...
but I don't know display result is "1097739649"
How to revert it to date format?

Posted: Thu Oct 28, 2004 3:35 am
by kennie1112
haha...I know how to revert the date format...

e.g.
$new_date=strtotime("-14 days");
$new_date=date('Ymd',$new_date); // result: 20041014

Thank for all people to help me... :D