Re: Function mktime() documentation question

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

 




Charles <peacech@xxxxxxxxx> wrote:

>On Sat, Mar 10, 2012 at 12:52 AM, Charles <peacech@xxxxxxxxx> wrote:
>> On Sat, Mar 10, 2012 at 12:07 AM, Tedd Sperling
><tedd.sperling@xxxxxxxxx> wrote:
>>> On Mar 9, 2012, at 11:17 AM, Charles wrote:
>>>
>>>> On Fri, Mar 9, 2012 at 10:58 PM, Tedd Sperling
><tedd.sperling@xxxxxxxxx> wrote:
>>>>> On Mar 9, 2012, at 5:37 AM, Ford, Mike wrote:
>>>>>>> From: Tedd Sperling [mailto:tedd.sperling@xxxxxxxxx]
>>>>>>> But why does anyone have to use the next month to figure out how
>>>>>>> many days there are are in this month? Do you see my point?
>>>>>>
>>>>>> Actually, no. To figure this out, somewhere along the line you've
>>>>>> got to know where the last day of this month / first day of next
>>>>>> month boundary lies, so I don't see how you can ever find the
>number
>>>>>> of days in a month without bringing the start of next month into
>it
>>>>>> somehow. (Even if it's implicitly be getting someone else's
>clever
>>>>>> code to figure out 'last day of this month'!)
>>>>>
>>>>> Well no, I don't need to know the first day of next month to know
>the last day of this month. That's like saying "I need to know who is
>going to stand at the 'end of the line' NEXT before I can tell who is
>standing at the 'end of the' line NOW."
>>>>
>>>> The number of days in each month is fixed, except for february. If
>>>> that's what you want, why don't make a table of the number of days
>in
>>>> each month, and check for the special case of leap year.
>>>
>>> No offense, but that's not the point. A look-up table would work,
>but why when there are all sorts of built-in functions that will?
>>
>> You just said yourself that "I don't need to know the first day of
>> next month to know the last day of this month", and AFAIK there is no
>> such function in PHP to get the number of days
>> without accessing the last second in the month. Besides, showing how
>> it is done is part of education.
>
>Unless, of course you install the "calendar" extension, of which it
>will provides just the required function
>
>http://php.net/manual/en/function.cal-days-in-month.php
>
>-- 
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, visit: http://www.php.net/unsub.php

What about just doing this:

intval(date("t"));

And you can pass in an argument to date() if you need a specific month. 

Thanks,
Ash
http://ashleysheridan.co.uk

-- 
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