note 79219 deleted from function.strtotime by danbrown
| From: | danbrown@php.net | Date: | Tue, 02 Dec 2008 15:15:03 +0000 |
| Subject: | note 79219 deleted from function.strtotime by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-147551@lists.php.net to get a copy of this message | ||
Note Submitter: grey580 at yahoo dot com
----
Not sure why the ordinals are not on this page.
However I was trying to subtract some hours from a certain date.
echo date('m-d-Y', strtotime("- x hours"));
This code would not work. Instead it would add two hours.
You must use the ordinal ago.
echo date('m-d-Y', strtotime("x hours ago"));
Will return the right date.
Here are the ordinals.
Relative and Ordinal Specifiers:
ago: past time relative to now; such as "24 hours ago"
tomorrow: 24 hours later than the current date and time
yesterday: 24 hours earlier than the current date and time
today: the current date and time
now: the current date and time
last: modifier meaning "the preceding"; for example, "last tuesday"
this: the given time during the current day or the next occurrence of the given time; for example,
"this 7am" gives the timestamp for 07:00 on the current day, while "this week"
gives the timestamp for one week from the current time
next: modifier meaning the current time value of the subject plus one; for example, "next
hour"
first: ordinal modifier, esp. for months; for example, "May first" (actually, it's
just the same asnext)
third: see first (note that there is no "second" for ordinality, since that would conflict
with thesecond time value)
fourth: see first
fifth: see first
sixth: see first
seventh: see first
eighth: see first
ninth: see first
tenth: see first
eleventh: see first
twelfth: see first