PHP | time() Function Last Updated : 05 May, 2018 Comments Improve Suggest changes 2 Likes Like Report The time() function is a built-in function in PHP which returns the current time measured in the number of seconds since the Unix Epoch. The number of seconds can be converted to the current date using date() function in PHP. Syntax: int time() Parameter: This function does not accepts any parameters as shown above. Return Value: This function returns the current time measured in the number of seconds since the Unix Epoch. Note: All output of programs corresponds to the date when the article was written. Below programs illustrate the time() function: Program 1: The program below prints the current time in term of seconds. php <?php // PHP program to demonstrate the use of current // time in seconds since Unix Epoch // variable to store the current time in seconds $currentTimeinSeconds = time(); // prints the current time in seconds echo $currentTimeinSeconds; ?> Output: 1525376494 Program 2: The program below prints the current time in date format. php <?php // PHP program to demonstrate the use of current // date since Unix Epoch // variable to store the current time in seconds $currentTimeinSeconds = time(); // converts the time in seconds to current date $currentDate = date('Y-m-d', $currentTimeinSeconds); // prints the current date echo ($currentDate); ?> Output: 2018-05-03 Create Quiz Comment G gopaldave Follow 2 Improve G gopaldave Follow 2 Improve Article Tags : Misc Web Technologies PHP PHP-date-time Explore BasicsPHP Syntax4 min readPHP Variables5 min readPHP | Functions6 min readPHP Loops4 min readArrayPHP Arrays5 min readPHP Associative Arrays4 min readMultidimensional arrays in PHP5 min readSorting Arrays in PHP4 min readOOPs & InterfacesPHP Classes2 min readPHP | Constructors and Destructors5 min readPHP Access Modifiers4 min readMultiple Inheritance in PHP4 min readMySQL DatabasePHP | MySQL Database Introduction4 min readPHP Database connection2 min readPHP | MySQL ( Creating Database )3 min readPHP | MySQL ( Creating Table )3 min readPHP AdvancePHP Superglobals6 min readPHP | Regular Expressions12 min readPHP Form Handling4 min readPHP File Handling4 min readPHP | Uploading File3 min readPHP Cookies9 min readPHP | Sessions7 min read Like