php.js : strtotime() function

strtotime() function

The strtotime() function is used to convert an english datetime description (string) to a UNIX timestamp.




strtotime (dttime_string, ts_now)


Name Description Required / Optional Type
dttime_string The string to parse. Required String
ts_now The timestamp used to calculate the returned value. Optional Integer

Example of php.js strtotime() function:

In the following web document strtotime() function returns unix timestamp.

echo strtotime('now').'<br>';
echo strtotime('10 January 2000').'<br>';
echo strtotime('+1 day').'<br>';
echo strtotime('+1 week').'<br>';
echo strtotime('+2 days 6 hours 2 seconds').'<br>';
echo strtotime('next Monday').'<br>';
echo strtotime('last Saturday').'<br>';

View the example of php.js strtotime() function in the browser

Download phpjs.zip

Previous: php.js : strptime() function
Next: php.js : time() function

Follow us on Facebook and Twitter for latest update.