PHP strtotime() parses English-like date strings into Unix timestamps.
Code examples
echo date('Y-m-d', strtotime('+1 week'));
echo date('Y-m-d', strtotime('next Monday'));
Check for failure:
$timestamp = strtotime($input);
if ($timestamp === false) {
throw new InvalidArgumentException('Invalid date');
}
Common errors
Relative phrases depend on the current time and timezone. For critical logic, prefer DateTimeImmutable with explicit timezones.
Related tool
Try the PHP strtotime Tester.