The Unix timestamp is designed to track time as a running total of seconds from the Unix Epoch on January 1st, 1970 at UTC. To add 24 hours to a Unix timestamp we can use any of these methods:
Method 1: Convert 24 hours to seconds and add the result to current Unix time.
time() + (24*60*60);
Method 2: Since hours in a day vary in systems such as Daylight saving time (DST) from exactly 24 hours in a day. It’s better to use PHP strtotime() Function to properly account for these anomalies. Using strtotime to parse current DateTime and one day to timestamp
Method 3: Using DateTime class we can achieve same result. First create a DateTime object with current timestamp and add interval of one day. P1D represents a Period of 1 Day interval to be added.
// Get current time stamp
// Add interval of P1D or Period of 1 Day
- Calculating total number of Hours, Days, Minutes and Seconds between two dates in Golang
- UNIX Full Form
- How to check for two timestamp for the same day?
- Pipes and Filters in Linux/Unix
- How to convert timestamp to time ago in PHP ?
- HTML | DOM timeStamp Event Property
- Convert minutes to hours/minutes with the help of JQuery
- Convert timestamp to readable date/time in PHP
- Getting the current date and time with timestamp in local and other timezones in Golang
- Strict Aliasing Rule in C with Examples
- Deadline scheduler in Operating System
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.