I need your help for datediff of previous month of current date. Example the current date is 2005-07-11. How to get previous month of current date, eg 2005-06-11.

Pls advise me

    Well, you can read up on date() and mktime() functions. Here's something small that will do it:

    <?php
    
    $today = date('Y-m-d');
    $prev = date('Y-m-d', mktime(0, 0, 0, date('m')-1, date('d'), date('Y')));
    
    echo 'Today: '.$today.'<br>1 Month Ago: '.$prev;
    ?>

    ~Brett

      Write a Reply...