Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.php > #2951
| From | dougatmilmacdotcom@example.com (Doug Miller) |
|---|---|
| Newsgroups | comp.lang.php |
| Subject | Re: strtotime |
| Date | 2011-08-24 03:09 +0000 |
| Organization | A noiseless patient Spider |
| Message-ID | <j31q26$atf$1@dont-email.me> (permalink) |
| References | <0f753a9b-9229-4dd7-ab20-0e750ed9baed@m6g2000prh.googlegroups.com> |
In article <0f753a9b-9229-4dd7-ab20-0e750ed9baed@m6g2000prh.googlegroups.com>, BKDotCom <kent.brad@gmail.com> wrote:
>Can anyone explain this to me:
>
>shouldn't these to both return the same timestamp?
>
>$ts = 1204351200;
>strtotime('+1 month',$ts); // returns 1207026000
>strtotime('@'.$ts.' +1 month')); // returns 1207029600... where's the
>extra 1 hour coming from?
http://php.net/manual/en/function.strtotime.php
"The function expects to be given a string containing an English date format
and will try to parse that format into a Unix timestamp (the number of seconds
since January 1 1970 00:00:00 UTC), relative to the timestamp given in now, or
the current time if now is not supplied."
Note in particular the the last nine words: "or the current time if now is not
supplied."
Your first call to strtotime() supplies the 'now' parameter. The second one
does not. That they do not produce the same result should not be a surprise.
Back to comp.lang.php | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
strtotime BKDotCom <kent.brad@gmail.com> - 2011-08-23 19:09 -0700 Re: strtotime dougatmilmacdotcom@example.com (Doug Miller) - 2011-08-24 03:09 +0000 Re: strtotime "Álvaro G. Vicario" <alvaro.NOSPAMTHANX@demogracia.com.invalid> - 2011-08-24 09:31 +0200
csiph-web