Thursday, October 24, 2013

Getting time and date from timestamp on php

Usually we record date and time date on MySQL table as timestamp  Seconds since the Unix Epoch (January 1 1970 00:00:00 GMT)

It's like 1171502725

But we can read date time another date from it directly.

You can use following PHP Script to Get Date and Tme from time stamp on PHP

<? php

$date = date('d-m-Y', $timestamp);
$time = date('Gi.s', $timestamp);

?>
Date is
 <?=$date;?> <br/>
Time is
 <?=$time;?> <br/>

0 comments:

Post a Comment