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.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:
2021-11-11 15:28:05
16
- PHP 8.0 / MySQL 5.7 mt_rand strtotime array_reduce date is_null print_r
last run:
2021-11-11 15:08:49
11
- PHP 8.0 / MySQL 5.7 mt_rand strtotime array_reduce date is_null print_r
last run:
2021-11-11 15:09:28
10
- PHP 8.0 / MySQL 5.7 mt_rand strtotime array_map date array_column max array_keys
last run:
2021-11-11 15:27:34
9
- PHP 8.0 / MySQL 5.7 mt_rand strtotime array_map date array_column max array_keys
last run:
2021-11-11 15:26:49
8
- PHP 7 / MySQL 8.0 date strtotime array_push
last run:
2022-03-23 00:19:05
8
- PHP 8.0 / MySQL 5.7 mt_rand strtotime array_map date array_column min array_keys
last run:
2021-12-06 18:39:55
7
- PHP 8.0 / MySQL 5.7 mt_rand strtotime array_map date array_column max array_keys
last run:
2021-11-11 15:30:30
7
- PHP 8.0 / MySQL 5.7 mt_rand strtotime array_reduce date is_null print_r
last run:
2021-11-11 15:10:40
7
strtotime - New snippets
-
PHP 8.0 / MySQL 5.7 strtotime date
added at:
2022-05-23 06:54:27
1
-
PHP 8.0 / MySQL 5.7 strtotime
added at:
2022-05-23 06:53:34
1
-
PHP 8.1 / MySQL 5.7 date strtotime range count print_r
added at:
2022-05-17 15:38:27
2
-
PHP 8.1 / MySQL 5.7 date strtotime range count print_r
added at:
2022-05-17 15:38:07
1
-
PHP 8.1 / MySQL 5.7 date strtotime range count print_r
added at:
2022-05-17 15:37:43
1
-
PHP 8.1 / MySQL 5.7 date strtotime range count print_r
added at:
2022-05-17 15:37:13
1
-
PHP 8.1 / MySQL 5.7 date strtotime count var_dump print_r
added at:
2022-05-17 15:36:12
1
-
PHP 8.1 / MySQL 5.7 date strtotime count var_dump print_r
added at:
2022-05-17 15:36:06
1
-
PHP 8.1 / MySQL 5.7 date strtotime count print_r
added at:
2022-05-17 15:35:34
1
-
PHP 8.1 / MySQL 5.7 date strtotime count print_r
added at:
2022-05-17 15:33:18
1