php get date from timestamp

Its very easy in php to convert any valid timestamp value to php date time.The date() function and getdate() function do exactly what you required.here I am presensting some of example how to convert valid timestamp to php

    //php_get_date_from_timestamp.php
    $timestamp=time()-86400; //This is for just example Previouse day timestamp
    $date=date("m/d/Y h:i:s A'",$timestamp);
    echo $date;
    //another Way
    
    $DateArr=getdate($timestamp);
     echo $DateArr['mon'].'/'.$DateArr['mday'].'/'.$DateArr['year'].' '.$DateArr['hours'].':'.$DateArr['minutes'].':'.$DateArr['seconds'] ;
    

Leave a Reply

Your email address will not be published. Required fields are marked *