Re: Function mktime() documentation question

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

 



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

I like things to be self-contained. For the exception of multiverse arguments, everything should be self evident.

>> But instead, we have to use:
>> 
>> $next_month = $this_month +1;
>> $what_date = getdate(mktime(0, 0, 0, $next_month, 0, $year));
>> $days_in_this_month = $what_date['mday'];
> 
> To me, that's a clever and elegant solution. It's clear that our
> brains just work differently on this one.

We all have differences in perception, how we analyze problems, and how we create solutions -- and that's a good thing.

> Side-point: I find it interesting that getdate() has all sorts of
>> neat descriptions for the current month (such as, what weekday a
>> numbered day is), but lacks how many days are in the month. Doesn't
>> that seem odd?
> 
> Now that's a decent point: I can see where you're coming from with that
> one. I don't know what performance penalty there might be (if any) to
> calculate that for every call to getdate(), but it certainly seems like
> a reasonable feature request.

I'm glad I have a decent point somewhere in this exchange and that we agree on something.  :-)

Cheers,

tedd


_____________________
tedd.sperling@xxxxxxxxx
http://sperling.com







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