PHP codes for date and time



creating php Timestamp

$t=time();

Date, month and year format to Timestamp

$time_stamp = strtotime("$year/$month/$day");

or

$time_stamp = strtotime("$year/$month/$day $hour:$minute:$second");

Time stamp to date,month and year format

$p= date("d/m/y",$timestamp);

or

$p= date("d/m/y h:i:s",$timestamp);//i for minute

Date function

<?php
$d = date(d);
$m = date(m);
$y = date(y);
$h = date(H);
$i = date(i);//Minute
$s = date(s);
echo "$d / $m /$y /$h /$i /$s";
?>