Re: strtotime()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Aug 23, 2010 at 05:57:28PM -0400, Daniel Brown wrote:
> On Mon, Aug 23, 2010 at 17:02, Ashley Sheridan <ash@xxxxxxxxxxxxxxxxxxxx> wrote:
> >
> > The example you quote as being straight from the manual page is actually
> > from the user-submitted code snippets, and I can't find the
> > documentation to support it. I can only assume that it's possibly an
> > experimental thing, or something that shouldn't work but by freak
> > coincidence does occasionally. Maybe use mktime() instead to get the
> > dates?
> 
>     Relative date strings - specifically including those terms - are
> in PHP5 >= 5.3.0 exclusively, for now.  I don't believe there are any
> plans to backport it to the 5.2 branch.
> 
>     Rick, if you want to add this as a "Documentation Problem" to
> http://bugs.php.net/, one of us will likely add it to the
> documentation, as it probably should not only be noted, but also be in
> an easy-to-find place (you know, such as right there on the
> strtotime() manual entry).

After I sent my original post the one and only user comment on the
relative date strings man page was pointed out to me. So, it's there but
how many people make a habit of reading all the user comments?

Anyway, the following work:

// first day of this month
$t1 = strtotime(date('Y-m',strtotime('this month')));

// last day of next month
// get the first day of month after next and subtract one day
$t2 = strtotime(date('Y-m',$t1 + (86400 * 70)))-86400;

-- 
"I'm so optimistic I'd go after Moby Dick in a row boat and take the
 tartar sauce with me." -- Zig Zigler
    Rick Pasotto    rick@xxxxxxxx    http://www.niof.net

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux