← All built-ins / strtotime()
strtotime()
strtotime(string $s): int
Parameters
| Name | Type | Description |
|---|---|---|
| $s | string | date/time string: "YYYY-MM-DD HH:MM:SS", "YYYY-MM-DD", "HH:MM:SS" |
Return value
Unix timestamp, or 0 when unparseable.
Example
echo date("Y-m-d", strtotime("2024-12-24")), "
";
echo strtotime("2024-03-15 12:30:00") > 0 ? "parsed" : "failed", "
";2024-12-24 parsed