What is use of time() Function in php ?
Php time() function basically use for returns a current unix timestamp. In which, you can utilize the date() function to format it to your desiderata.
You can see below example of time() function.
<?php
$Currenttime=time();
//$Currenttime is a variable in which store current date and time
echo($Currenttime . "<br>");
//when echo $Currenttime then echo only date in this 1448270711 format
echo(date("Y-m-d",$Currenttime). "<br>");
//when echo $Currenttime in ("Y-m-d") format then date will come 2015-11-23
// If you want print current date and time both then use echo(date("Y-m-d h:i:sa",$Currenttime));
//look like this:
echo(date("Y-m-d h:i:sa",$Currenttime));
?>
So, finally output will come
1448271768
2015-11-23
2015-11-23 03:12:48pm
0 Comment(s)