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.
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.
Program 2: The program below prints the current time in date format.
- Maximum execution time taken by a PHP Script
- PHP | Date and Time
- Generating OTP (One time Password) in PHP
- Measuring script execution time in PHP
- Convert timestamp to readable date/time in PHP
- PHP | Spreadsheet | Setting a date and/or time value in a cell
- How to convert timestamp to time ago in PHP ?
- How to calculate total time of an array in PHP ?
- How to call a function automatically after waiting for some time using jQuery?
- D3.js time.clamp() Function
- D3.js time.interpolate() Function
- D3.js time.tickFormat() Function
- D3.js time.ticks() Function
- D3.js time.copy() Function
- D3.js scaleTime time() Function
- D3.js time.invert() Function
- D3.js time.domain() Function
- D3.js time.range() Function
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.