ASPit - Totally ASP JSit - Totally JavaScript
Search PHPit

Use this textbox to search for articles on PHPit. Seperate keywords with a space.

Advertisements

Get current datestamp

With this function you can easily retrieve the current date stamp. Very useful for comparing it with data from a MySQL database.

function get_current_datestamp(){
    
//get the current timestamp
    
$currdate gmdate("Ymd");
    
$currday substr($currdate,6,2);
    
$currmonth substr($currdate,4,2);
    
$curryear substr($currdate,0,4);
    
$currdate_stamp = ($curryear "-" $currmonth "-" $currday);

    return 
$currdate_stamp;

}
?>

One Response to “Get current datestamp”

  1. BraveBrain Says:

    You get the same thing by
    date(”Y-m-d”);

Leave a Reply