strtotime
strtotime — Parse about any English textual datetime description into a Unix timestamp.Description
strtotime( string $datetime, int|null $baseTimestamp = null ): int|falseThe function expects to be given a string containing an English date format and will try to parse that format into a Unix timestamp (the number of seconds since January 1 1970 00:00:00 UTC), relative to the timestamp given in baseTimestamp, or the current time if baseTimestamp is not supplied.
Warning: The Unix timestamp that this function returns does not contain information about time zones. In order to do calculations with date/time information, you should use the more capable DateTimeImmutable.
Each parameter of this function uses the default time zone unless a time zone is specified in that parameter. Be careful not to use different time zones in each parameter unless that is intended. See date_default_timezone_get() on the various ways to define the default time zoneParameters
datetime
A date/time string. Valid formats are explained in Date and Time Formats.
baseTimestamp
The timestamp which is used as a base for the calculation of relative dates.
Return Values
Returns a timestamp on success, false otherwise.More information about strtotime on official PHP documentation site
strtotime - Popular snippets
- PHP 8.1 / MySQL 5.7 date strtotime time floor
last run:
2022-08-10 18:42:58
38
- PHP 8.0 / MySQL 8.0 strtotime date
last run:
2022-10-06 09:38:07
32
- PHP 8.1 / MySQL 5.7 date strtotime floor
last run:
2022-08-10 19:39:49
22
- PHP 8.0 / MySQL 5.7 strtotime
last run:
2022-04-08 04:40:27
19
- PHP 8.0 / MySQL 5.7 mt_rand strtotime array_map date array_column max array_keys
last run:
2023-10-31 14:44:52
18
- PHP 8.0 / MySQL 8.0 strtotime date
last run:
2023-01-09 04:31:26
14
- PHP 7.4 / MySQL 5.7 preg_match str_replace date_default_timezone_set strtotime date round abs
last run:
2023-03-26 14:06:36
13
- PHP 8.1 / MySQL 5.7 date strtotime
last run:
2024-08-14 04:36:23
12
- PHP 8.2.13 / MySQL 5.7 date strtotime
last run:
2024-02-29 21:40:46
11
- PHP 8.0 / MySQL 5.7 date strtotime substr print_r
last run:
2022-06-01 19:23:57
11
strtotime - New snippets
-
PHP 8.0 / MySQL 8.0 json_encode array_map strtotime
added at:
2024-12-03 04:44:43
1
-
PHP 8.0 / MySQL 8.0 json_encode array_map strtotime
added at:
2024-12-03 04:44:32
1
-
PHP 8.1 / MySQL 8.0 date strtotime
added at:
2024-11-26 06:11:52
1
-
PHP 8.1 / MySQL 8.0 date strtotime
added at:
2024-11-26 06:10:43
1
-
PHP 8.1 / MySQL 8.0 date strtotime
added at:
2024-11-26 06:10:15
1
-
PHP 8.1 / MySQL 8.0 date strtotime
added at:
2024-11-26 06:09:59
1
-
PHP 8.1 / MySQL 5.7 time strtotime date
added at:
2024-11-13 15:37:43
1
-
PHP 8.1 / MySQL 5.7 preg_replace var_dump date strtotime
added at:
2024-11-11 07:12:36
1
-
PHP 8.1 / MySQL 5.7 preg_replace var_dump date strtotime
added at:
2024-11-11 07:11:58
1
-
PHP 8.1 / MySQL 5.7 preg_replace var_dump date strtotime
added at:
2024-11-11 07:11:38
1