Converting a string to a timestamp is one of my favorite things about PHP. In
fact when trying to decide which language to build [HolidayAPI][holidayapi] in
I couldn’t find an implementation of PHP’s
strtotime() that rivaled the
strtotime() function takes a textual string as input and then
spits back a timestamp, which can then be used to generate a more human
readable date time string.
Here are some examples of how you can use
strtotime() to find out the date
and time of relative strings:
Not ever string works but quite a few do. Also the resulting timestamp is based on the current day unless you explicitly tell it a date, like my last example.
I recently found out about an interval that I didn’t realized worked. It’s the
weekday keyword. Would come in handy when you need to calculate business
days for say, shipping or something.
As mentioned, this returns the UNIX timestamp but you can easily convert it to
something more friendly with the