Friday, July 27, 2012

how to get past date in php

<?php // get past 15 days date  in php

$d1=date('Y-m-d'strtotime('-15 days')); 

date('Y-m-d'strtotime('-15 months')); 

//$d1=date('Y-m-d'strtotime('-20 year')); 

// next 15 days date in php

$d1=date('Y-m-d', strtotime('15 days'));

 $date = "2012-10-10";
$newdate = strtotime ( '-10 days' , strtotime ( $date ) ) ;
$newdate = date ( 'Y-m-d' , $newdate );

echo $newdate;


1 comment:

  1. Hello! I know this is kind of off-topic but I needed to ask.
    Does building a well-established blog like yours take a massive amount work?

    I am brand new to writing a blog however I do write in my
    journal daily. I'd like to start a blog so I can share
    my experience and views online. Please let me know if you have
    any recommendations or tips for new aspiring bloggers. Appreciate it!

    Here is my web page; jule


If you Satisfied , Please Leave a comment