SyntaxStudy
Sign Up
Home PHP Reference strtotime()

strtotime()

function

Parses an English textual datetime description into a Unix timestamp.

Syntax

strtotime(string $datetime): int|false

Example

php
<?php
echo date('Y-m-d', strtotime('+30 days'));   // 30 days from now
echo date('Y-m-d', strtotime('next Monday'));
echo date('Y-m-d', strtotime('-1 month'));

if (strtotime($expiry) < time()) {
    echo 'Expired!';
}