|The PHP strtotime function is used to store a Unix timestamp as a value of a variable. But what makes this PHP function so versatile is the list of "human" keywords and abbreviations that you can use to create a specific timestamp to store in that variable. Let's take a look at the code and then the list of keywords and abbreviations.|
As you can see, the syntax for the strtotime function is straight forward. It begins with the variable name followed by an equal sign. Then inside the parenthesis and quotation marks is where the magic happens. You can use any of the keywords and abbreviations from the list below to create a timestamp for the variable. You can also use combinations of keywords and abbreviations. For the example above, the value stored in the $birthday variable will be my niece's birthday which is June 6, 2000.
Below is the list of keywords and abbreviations. Try replacing my example with various combinations from the list below.
Units of time such as
year, month, week, day, hour, minute, second, am, pm, fortnight
English words for time such as
ago, now, last, this, next, tomorrow, yesterday
Minus and Plus - and +
Numbers 1, 2, 3 . . .
gmt, pdt, akst
Name of the months and abbreviations
Day of the week and abbreviations