In this article, you will learn how to get the time in seconds. The time() function in PHP returns the time in seconds that is the total number of seconds since January 1 1970 GMT (Unix Epoch).
What is the syntax of the TIME() function in PHP?
time()
Examples of the TIME() function
Example 1. In this example, We simply get the time in seconds and then convert it into specific format of the date.
<?php
$time=time();
echo($time);
echo(date("m-d-y",$time));
?>