-
- strtotime(”2009-1-22″)
- echo strtotime(”2009-1-22″) Result: 1232553600
Copy code
Instructions: Return to 0:00 on January 22, 2009 Minutes 0 seconds timestamp
Second, the php timestamp function obtains the English text date and time
For easy comparison, use date to convert the current timestamp and the specified timestamp into system time
1) Print the timestamp at this time tomorrow strtotime(”+1 day”)
-
- //Convert timestamp to date
- $date_time_array = getdate(1297845628); //1311177600 1316865566
- $hours = $date_time_array["hours"];
- $minutes = $date_time _array[" minutes"];
- $seconds = $date_time_array["seconds"];
- $month = $date_time_array["mon"];
- $day = $date_time_array["mday"];
- $year = $date_time_array["year" ];
-
- echo "year:$yearnmonth:$monthnday:$daynhour:$hoursnminutes:$minutesnseconds:$secondsn";
-
- //Convert normal date to timestamp
- echo mktime(0, 0, 0, 9, 18, 2011) . "n";
- echo mktime(0, 0, 0, 9, 25, 2011) . "n";
-
- /*
- time();
- is to get the current time, but it is an integer
- */
- //You can format this
- echo "time() displays the year, month, day, hour, minute and second:" . date("Y-m-d H:i:s", time()) . "n";
- // In this way, the hours, minutes and seconds are displayed together
- echo "time() only displays the year, month and day:" . date("Y-m-d ", time()) . "n"; //Only the year, month and day are displayed
-
- echo "Time Stamp formatting: " . date("Y-m-d H:i:s", 1297845628) . "n"; //Use timestamp directly
-
- /* vim: set ts=4 sw=4 sts=4 tw=100 noet : */
- ?>
Copy code
|