Supported Versions: PHP 4, PHP 5, PHP 7, PHP 8
Parse about any English textual datetime description into a Unix timestamp
<?php strtotime(string $datetime, ?int $baseTimestamp = null): int|false
<?php static private function cachedFileResponse($filename, $contentType, $lastModified, $downloadCallback)
{
$expires = strtotime('+1 year');
$cacheControl = 'public, max-age=31536000';
if (static::matchesCache($lastModified)) {
<?php {
$ifModifiedSince = app(Request::class)->header('if-modified-since');
return $ifModifiedSince !== null && @strtotime($ifModifiedSince) === $lastModified;
}
static function httpDate($timestamp)
<?php protected function replaceBefore($message, $attribute, $rule, $parameters)
{
if (! strtotime($parameters[0])) {
return str_replace(':date', $this->getDisplayableAttribute($parameters[0]), $message);
}
<?php }
try {
if ((! is_string($value) && ! is_numeric($value)) || strtotime($value) === false) {
return false;
}
} catch (Exception) {
<?php self::assertNotFalse($row);
$row = array_change_key_case($row, CASE_LOWER);
self::assertEquals('2010-01-01 10:10:11', date('Y-m-d H:i:s', strtotime($row['add_seconds'])));
self::assertEquals('2010-01-01 10:10:09', date('Y-m-d H:i:s', strtotime($row['sub_seconds'])));
self::assertEquals('2010-01-01 10:15:10', date('Y-m-d H:i:s', strtotime($row['add_minutes'])));
self::assertEquals('2010-01-01 10:05:10', date('Y-m-d H:i:s', strtotime($row['sub_minutes'])));
<?php $row = array_change_key_case($row, CASE_LOWER);
self::assertEquals('2010-01-01 10:10:11', date('Y-m-d H:i:s', strtotime($row['add_seconds'])));
self::assertEquals('2010-01-01 10:10:09', date('Y-m-d H:i:s', strtotime($row['sub_seconds'])));
self::assertEquals('2010-01-01 10:15:10', date('Y-m-d H:i:s', strtotime($row['add_minutes'])));
self::assertEquals('2010-01-01 10:05:10', date('Y-m-d H:i:s', strtotime($row['sub_minutes'])));
self::assertEquals('2010-01-01 13:10', date('Y-m-d H:i', strtotime($row['add_hour'])));
<?php self::assertEquals('2010-01-01 10:10:11', date('Y-m-d H:i:s', strtotime($row['add_seconds'])));
self::assertEquals('2010-01-01 10:10:09', date('Y-m-d H:i:s', strtotime($row['sub_seconds'])));
self::assertEquals('2010-01-01 10:15:10', date('Y-m-d H:i:s', strtotime($row['add_minutes'])));
self::assertEquals('2010-01-01 10:05:10', date('Y-m-d H:i:s', strtotime($row['sub_minutes'])));
self::assertEquals('2010-01-01 13:10', date('Y-m-d H:i', strtotime($row['add_hour'])));
self::assertEquals('2010-01-01 07:10', date('Y-m-d H:i', strtotime($row['sub_hour'])));
<?php self::assertEquals('2010-01-01 10:10:11', date('Y-m-d H:i:s', strtotime($row['add_seconds'])));
self::assertEquals('2010-01-01 10:10:09', date('Y-m-d H:i:s', strtotime($row['sub_seconds'])));
self::assertEquals('2010-01-01 10:15:10', date('Y-m-d H:i:s', strtotime($row['add_minutes'])));
self::assertEquals('2010-01-01 10:05:10', date('Y-m-d H:i:s', strtotime($row['sub_minutes'])));
self::assertEquals('2010-01-01 13:10', date('Y-m-d H:i', strtotime($row['add_hour'])));
self::assertEquals('2010-01-01 07:10', date('Y-m-d H:i', strtotime($row['sub_hour'])));
self::assertEquals('2010-01-11', date('Y-m-d', strtotime($row['add_days'])));
<?php self::assertEquals('2010-01-01 10:10:09', date('Y-m-d H:i:s', strtotime($row['sub_seconds'])));
self::assertEquals('2010-01-01 10:15:10', date('Y-m-d H:i:s', strtotime($row['add_minutes'])));
self::assertEquals('2010-01-01 10:05:10', date('Y-m-d H:i:s', strtotime($row['sub_minutes'])));
self::assertEquals('2010-01-01 13:10', date('Y-m-d H:i', strtotime($row['add_hour'])));
self::assertEquals('2010-01-01 07:10', date('Y-m-d H:i', strtotime($row['sub_hour'])));
self::assertEquals('2010-01-11', date('Y-m-d', strtotime($row['add_days'])));
self::assertEquals('2009-12-22', date('Y-m-d', strtotime($row['sub_days'])));
<?php self::assertEquals('2010-01-01 10:15:10', date('Y-m-d H:i:s', strtotime($row['add_minutes'])));
self::assertEquals('2010-01-01 10:05:10', date('Y-m-d H:i:s', strtotime($row['sub_minutes'])));
self::assertEquals('2010-01-01 13:10', date('Y-m-d H:i', strtotime($row['add_hour'])));
self::assertEquals('2010-01-01 07:10', date('Y-m-d H:i', strtotime($row['sub_hour'])));
self::assertEquals('2010-01-11', date('Y-m-d', strtotime($row['add_days'])));
self::assertEquals('2009-12-22', date('Y-m-d', strtotime($row['sub_days'])));
self::assertEquals('2010-01-08', date('Y-m-d', strtotime($row['add_weeks'])));
<?php self::assertEquals('2010-01-01 10:05:10', date('Y-m-d H:i:s', strtotime($row['sub_minutes'])));
self::assertEquals('2010-01-01 13:10', date('Y-m-d H:i', strtotime($row['add_hour'])));
self::assertEquals('2010-01-01 07:10', date('Y-m-d H:i', strtotime($row['sub_hour'])));
self::assertEquals('2010-01-11', date('Y-m-d', strtotime($row['add_days'])));
self::assertEquals('2009-12-22', date('Y-m-d', strtotime($row['sub_days'])));
self::assertEquals('2010-01-08', date('Y-m-d', strtotime($row['add_weeks'])));
self::assertEquals('2009-12-25', date('Y-m-d', strtotime($row['sub_weeks'])));
<?php self::assertEquals('2010-01-01 13:10', date('Y-m-d H:i', strtotime($row['add_hour'])));
self::assertEquals('2010-01-01 07:10', date('Y-m-d H:i', strtotime($row['sub_hour'])));
self::assertEquals('2010-01-11', date('Y-m-d', strtotime($row['add_days'])));
self::assertEquals('2009-12-22', date('Y-m-d', strtotime($row['sub_days'])));
self::assertEquals('2010-01-08', date('Y-m-d', strtotime($row['add_weeks'])));
self::assertEquals('2009-12-25', date('Y-m-d', strtotime($row['sub_weeks'])));
self::assertEquals('2010-03-01', date('Y-m-d', strtotime($row['add_month'])));
<?php self::assertEquals('2010-01-01 07:10', date('Y-m-d H:i', strtotime($row['sub_hour'])));
self::assertEquals('2010-01-11', date('Y-m-d', strtotime($row['add_days'])));
self::assertEquals('2009-12-22', date('Y-m-d', strtotime($row['sub_days'])));
self::assertEquals('2010-01-08', date('Y-m-d', strtotime($row['add_weeks'])));
self::assertEquals('2009-12-25', date('Y-m-d', strtotime($row['sub_weeks'])));
self::assertEquals('2010-03-01', date('Y-m-d', strtotime($row['add_month'])));
self::assertEquals('2009-11-01', date('Y-m-d', strtotime($row['sub_month'])));
<?php self::assertEquals('2010-01-11', date('Y-m-d', strtotime($row['add_days'])));
self::assertEquals('2009-12-22', date('Y-m-d', strtotime($row['sub_days'])));
self::assertEquals('2010-01-08', date('Y-m-d', strtotime($row['add_weeks'])));
self::assertEquals('2009-12-25', date('Y-m-d', strtotime($row['sub_weeks'])));
self::assertEquals('2010-03-01', date('Y-m-d', strtotime($row['add_month'])));
self::assertEquals('2009-11-01', date('Y-m-d', strtotime($row['sub_month'])));
self::assertEquals('2010-10-01', date('Y-m-d', strtotime($row['add_quarters'])));
<?php self::assertEquals('2009-12-22', date('Y-m-d', strtotime($row['sub_days'])));
self::assertEquals('2010-01-08', date('Y-m-d', strtotime($row['add_weeks'])));
self::assertEquals('2009-12-25', date('Y-m-d', strtotime($row['sub_weeks'])));
self::assertEquals('2010-03-01', date('Y-m-d', strtotime($row['add_month'])));
self::assertEquals('2009-11-01', date('Y-m-d', strtotime($row['sub_month'])));
self::assertEquals('2010-10-01', date('Y-m-d', strtotime($row['add_quarters'])));
self::assertEquals('2009-04-01', date('Y-m-d', strtotime($row['sub_quarters'])));