note 79219 added to function.strtotime

From: Date: Thu, 15 Nov 2007 21:53:15 +0000
Subject: note 79219 added to function.strtotime
Groups: php.notes 
Request: Send a blank email to php-notes+get-132332@lists.php.net to get a copy of this message
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 ---- Server IP: 64.71.164.2 Probable Submitter: 216.242.101.8 ---- Manual Page -- http://www.php.net/manual/en/function.strtotime.php Edit -- https://master.php.net/note/edit/79219 Del: integrated -- https://master.php.net/note/delete/79219/integrated Del: useless -- https://master.php.net/note/delete/79219/useless Del: bad code -- https://master.php.net/note/delete/79219/bad+code Del: spam -- https://master.php.net/note/delete/79219/spam Del: non-english -- https://master.php.net/note/delete/79219/non-english Del: in docs -- https://master.php.net/note/delete/79219/in+docs Del: other reasons-- https://master.php.net/note/delete/79219 Reject -- https://master.php.net/note/reject/79219 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#132332) next »