Re: Function mktime() documentation question

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

 



    (To the list, as well.  First day with my new fingers, apparently....)

On Fri, Mar 9, 2012 at 08:09, Daniel Brown <danbrown@xxxxxxx> wrote:
> On Thu, Mar 8, 2012 at 21:23, Tedd Sperling <tedd.sperling@xxxxxxxxx> wrote:
>
>    This starts getting a bit off-topic from your original email, but
> knowing that you're trying to use it for teaching your classes at the
> college, it may be of some value to you.
>
>>> All of this aside, though, you may instead want to use something along the lines of date('d',strtotime('last day of this month')); in tandem with your date formatting.
>>
>> That's a good idea, but
>>
>>> date('d',strtotime('last day of this month'));
>>
>> gives me the number of days in *this* month, but not the next, or previous, month.
>>
>> I need the result to be whatever date was selected -- something like:
>>
>> $number_days = date('d',strtotime('last day of April, 2014'));
>>
>> But that doesn't work.
>
>    Sure it does, though you may have some issues when using
> punctuation, unnecessary words, or using capital letters for anything
> other than proper names.  What version of PHP are you using?  I get
> the correct answers for all of the following phrases:
>
>        "last day of April 2014"
>        "last day of this month"
>        "last day of next month"
>        "last day of last month"
>        "third Saturday March 2012"
>
>    Or you can even be excruciatingly redundant:
>
>        echo date('d',strtotime('last day of this
> month',strtotime('next month')));
>        echo date('d',strtotime('last day of this
> month',strtotime('February 2018')));
>        echo date('d',strtotime('second Monday',strtotime('September 2012')));
>
> --
> </Daniel P. Brown>
> Network Infrastructure Manager
> http://www.php.net/



-- 
</Daniel P. Brown>
Network Infrastructure Manager
http://www.php.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