PHP strtotime() Function

12 Jan 2025 | 1 min read

The PHP strtotime() function is used to convert an English text datetime into a Unix timestamp.

Syntax

Parameters

ParameterDescriptionRequired/Optional
TimeSpecifies a date/time stringRequired
NowA timestamp that calculate relative dates.Optional

Return

This function returns a timestamp on success, FALSE otherwise.

Example 1

Output:

 1533572997 1128297600 1533590997 1534177797 1534462202 1534118400 1533427200 

Example 2

Output:

 1534032000 2018-08-12 

Example 3

Output:

 1533859200 2018-08-10