Re: [PHP] Function mktime() documentation question

2012-03-12 Thread Tedd Sperling
On Mar 11, 2012, at 3:10 PM, Matijn Woudt wrote: On Sun, Mar 11, 2012 at 7:33 PM, Tedd Sperling tedd.sperl...@gmail.com wrote: Actually, this works for me: $days_in_month = date('t', mktime(0, 0, 0, $next_month, 0, $year)); But again, I don't see why I have to use next month to find the

Re: [PHP] Function mktime() documentation question

2012-03-12 Thread Ashley Sheridan
On Mon, 2012-03-12 at 15:53 -0400, Tedd Sperling wrote: On Mar 11, 2012, at 3:10 PM, Matijn Woudt wrote: On Sun, Mar 11, 2012 at 7:33 PM, Tedd Sperling tedd.sperl...@gmail.com wrote: Actually, this works for me: $days_in_month = date('t', mktime(0, 0, 0, $next_month, 0, $year));

Re: [PHP] Function mktime() documentation question

2012-03-11 Thread Ashley Sheridan
On Sat, 2012-03-10 at 20:38 -0500, Tedd Sperling wrote: On Mar 10, 2012, at 12:20 PM, Maciek Sokolewicz wrote: function getAmountOfDaysInAMonth($month, $year) { $days = array(31, (($year%4==0 and ($year%100 0 or $year%400==0)) ? 29 : 28), 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);

Re: [PHP] Function mktime() documentation question

2012-03-11 Thread Tedd Sperling
On Mar 11, 2012, at 6:12 AM, Ashley Sheridan wrote: I still don't see what's wrong with date(t); -- Thanks, Ash Ash: It's just too damn simple -- we need to make things complicated. :-) Actually, this works for me: $days_in_month = date('t', mktime(0, 0, 0, $next_month, 0, $year));

Re: [PHP] Function mktime() documentation question

2012-03-11 Thread Matijn Woudt
On Sun, Mar 11, 2012 at 7:33 PM, Tedd Sperling tedd.sperl...@gmail.com wrote: On Mar 11, 2012, at 6:12 AM, Ashley Sheridan wrote: I still don't see what's wrong with date(t); -- Thanks, Ash Ash: It's just too damn simple -- we need to make things complicated. :-) Actually, this

Re: [PHP] Function mktime() documentation question

2012-03-10 Thread Maciek Sokolewicz
On 09-03-2012 14:11, Daniel Brown wrote: (To the list, as well. First day with my new fingers, apparently) On Fri, Mar 9, 2012 at 08:09, Daniel Browndanbr...@php.net wrote: On Thu, Mar 8, 2012 at 21:23, Tedd Sperlingtedd.sperl...@gmail.com wrote: This starts getting a bit

Re: [PHP] Function mktime() documentation question

2012-03-10 Thread Matijn Woudt
On Sat, Mar 10, 2012 at 6:20 PM, Maciek Sokolewicz maciek.sokolew...@gmail.com wrote: On 09-03-2012 14:11, Daniel Brown wrote:     (To the list, as well.  First day with my new fingers, apparently) On Fri, Mar 9, 2012 at 08:09, Daniel Browndanbr...@php.net  wrote: On Thu, Mar 8, 2012 at

Re: [PHP] Function mktime() documentation question

2012-03-10 Thread Maciek Sokolewicz
On 10 March 2012 19:06, Matijn Woudt tijn...@gmail.com wrote: On Sat, Mar 10, 2012 at 6:20 PM, Maciek Sokolewicz maciek.sokolew...@gmail.com wrote: On 09-03-2012 14:11, Daniel Brown wrote: (To the list, as well. First day with my new fingers, apparently) On Fri, Mar 9, 2012

Re: [PHP] Function mktime() documentation question

2012-03-10 Thread tamouse mailing lists
I'm just a bit baffled why this isn't a standard library function. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] Function mktime() documentation question

2012-03-10 Thread Matijn Woudt
On Sat, Mar 10, 2012 at 9:47 PM, tamouse mailing lists tamouse.li...@gmail.com wrote: I'm just a bit baffled why this isn't a standard library function. Good question, but I think the problem here is that there are tons of these small functions, and you got to make a choice on what to implement

Re: [PHP] Function mktime() documentation question

2012-03-10 Thread Tedd Sperling
On Mar 10, 2012, at 12:20 PM, Maciek Sokolewicz wrote: function getAmountOfDaysInAMonth($month, $year) { $days = array(31, (($year%4==0 and ($year%100 0 or $year%400==0)) ? 29 : 28), 31, 30, 31, 30, 31, 31, 30, 31, 30, 31); return $days[$month+1]; } I like that -- here's a small

RE: [PHP] Function mktime() documentation question

2012-03-09 Thread Ford, Mike
-Original Message- From: Tedd Sperling [mailto:tedd.sperl...@gmail.com] Sent: 08 March 2012 23:15 To: PHP-General List [previous discussion snipped] Mike: Very well put. You say: Huh? The 0th day of next month *is* the last day of the current month, which gives you

Re: [PHP] Function mktime() documentation question

2012-03-09 Thread Lester Caine
Ford, Mike wrote: 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

Re: [PHP] Function mktime() documentation question

2012-03-09 Thread Daniel Brown
(To the list, as well. First day with my new fingers, apparently) On Fri, Mar 9, 2012 at 08:09, Daniel Brown danbr...@php.net wrote: On Thu, Mar 8, 2012 at 21:23, Tedd Sperling tedd.sperl...@gmail.com wrote:    This starts getting a bit off-topic from your original email, but knowing

Re: [PHP] Function mktime() documentation question

2012-03-09 Thread Tedd Sperling
On Mar 9, 2012, at 5:37 AM, Ford, Mike wrote: From: Tedd Sperling [mailto:tedd.sperl...@gmail.com] 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

Re: [PHP] Function mktime() documentation question

2012-03-09 Thread Charles
On Fri, Mar 9, 2012 at 10:58 PM, Tedd Sperling tedd.sperl...@gmail.com wrote: On Mar 9, 2012, at 5:37 AM, Ford, Mike wrote: From: Tedd Sperling [mailto:tedd.sperl...@gmail.com] 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

Re: [PHP] Function mktime() documentation question

2012-03-09 Thread Tedd Sperling
On Mar 9, 2012, at 11:17 AM, Charles wrote: On Fri, Mar 9, 2012 at 10:58 PM, Tedd Sperling tedd.sperl...@gmail.com wrote: On Mar 9, 2012, at 5:37 AM, Ford, Mike wrote: From: Tedd Sperling [mailto:tedd.sperl...@gmail.com] But why does anyone have to use the next month to figure out how many

Re: [PHP] Function mktime() documentation question

2012-03-09 Thread Charles
On Sat, Mar 10, 2012 at 12:07 AM, Tedd Sperling tedd.sperl...@gmail.com wrote: On Mar 9, 2012, at 11:17 AM, Charles wrote: On Fri, Mar 9, 2012 at 10:58 PM, Tedd Sperling tedd.sperl...@gmail.com wrote: On Mar 9, 2012, at 5:37 AM, Ford, Mike wrote: From: Tedd Sperling

Re: [PHP] Function mktime() documentation question

2012-03-09 Thread Charles
On Sat, Mar 10, 2012 at 12:52 AM, Charles peac...@gmail.com wrote: On Sat, Mar 10, 2012 at 12:07 AM, Tedd Sperling tedd.sperl...@gmail.com wrote: On Mar 9, 2012, at 11:17 AM, Charles wrote: On Fri, Mar 9, 2012 at 10:58 PM, Tedd Sperling tedd.sperl...@gmail.com wrote: On Mar 9, 2012, at

Re: [PHP] Function mktime() documentation question

2012-03-09 Thread Ashley Sheridan
Charles peac...@gmail.com wrote: On Sat, Mar 10, 2012 at 12:52 AM, Charles peac...@gmail.com wrote: On Sat, Mar 10, 2012 at 12:07 AM, Tedd Sperling tedd.sperl...@gmail.com wrote: On Mar 9, 2012, at 11:17 AM, Charles wrote: On Fri, Mar 9, 2012 at 10:58 PM, Tedd Sperling

Re: [PHP] Function mktime() documentation question

2012-03-09 Thread Charles
On Sat, Mar 10, 2012 at 12:57 AM, Charles peac...@gmail.com wrote: On Sat, Mar 10, 2012 at 12:52 AM, Charles peac...@gmail.com wrote: On Sat, Mar 10, 2012 at 12:07 AM, Tedd Sperling tedd.sperl...@gmail.com wrote: On Mar 9, 2012, at 11:17 AM, Charles wrote: On Fri, Mar 9, 2012 at 10:58 PM,

Re: [PHP] Function mktime() documentation question

2012-03-09 Thread Tedd Sperling
On Mar 9, 2012, at 12:52 PM, Charles wrote: On Sat, Mar 10, 2012 at 12:07 AM, Tedd Sperling tedd.sperl...@gmail.com wrote: 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

Re: [PHP] Function mktime() documentation question

2012-03-08 Thread Tedd Sperling
On Mar 7, 2012, at 4:28 PM, Daniel Brown wrote: On Wed, Mar 7, 2012 at 15:03, Tedd Sperling tedd.sperl...@gmail.com wrote: Hi gang: I am using the getdate(mktime()) functions to get month data (i.e., name of month, first weekday, last day, number of days). To get the number of days for

Re: [PHP] Function mktime() documentation question

2012-03-08 Thread Tedd Sperling
On Mar 8, 2012, at 11:20 AM, Ford, Mike wrote: -Original Message- From: Tedd Sperling [mailto:tedd.sperl...@gmail.com] From my code, the number of days in a month can be found by using 0 as the first index of the next month -- not the last day of the previous month. Huh? The 0th

Re: [PHP] Function mktime() documentation question

2012-03-08 Thread Daniel Brown
On Mar 8, 2012 6:14 PM, Tedd Sperling tedd.sperl...@gmail.com wrote: On Mar 8, 2012, at 11:20 AM, Ford, Mike wrote: -Original Message- From: Tedd Sperling [mailto:tedd.sperl...@gmail.com] From my code, the number of days in a month can be found by using 0 as the first index of

Re: [PHP] Function mktime() documentation question

2012-03-08 Thread Jim Lucas
On 03/08/2012 03:14 PM, Tedd Sperling wrote: On Mar 8, 2012, at 11:20 AM, Ford, Mike wrote: -Original Message- From: Tedd Sperling [mailto:tedd.sperl...@gmail.com] From my code, the number of days in a month can be found by using 0 as the first index of the next month -- not the last

Re: [PHP] Function mktime() documentation question

2012-03-08 Thread Jim Lucas
On 03/08/2012 04:24 PM, Jim Lucas wrote: On 03/08/2012 03:14 PM, Tedd Sperling wrote: On Mar 8, 2012, at 11:20 AM, Ford, Mike wrote: -Original Message- From: Tedd Sperling [mailto:tedd.sperl...@gmail.com] From my code, the number of days in a month can be found by using 0 as the first

Re: [PHP] Function mktime() documentation question

2012-03-08 Thread Jim Lucas
On 03/08/2012 04:31 PM, Jim Lucas wrote: On 03/08/2012 04:24 PM, Jim Lucas wrote: On 03/08/2012 03:14 PM, Tedd Sperling wrote: On Mar 8, 2012, at 11:20 AM, Ford, Mike wrote: -Original Message- From: Tedd Sperling [mailto:tedd.sperl...@gmail.com] From my code, the number of days in a

Re: [PHP] Function mktime() documentation question

2012-03-08 Thread Jim Lucas
On 03/08/2012 04:44 PM, Jim Lucas wrote: On 03/08/2012 04:31 PM, Jim Lucas wrote: On 03/08/2012 04:24 PM, Jim Lucas wrote: On 03/08/2012 03:14 PM, Tedd Sperling wrote: On Mar 8, 2012, at 11:20 AM, Ford, Mike wrote: -Original Message- From: Tedd Sperling

Re: [PHP] Function mktime() documentation question

2012-03-08 Thread Tedd Sperling
On Mar 8, 2012, at 6:53 PM, Daniel Brown wrote: On Mar 8, 2012 6:14 PM, Tedd Sperling tedd.sperl...@gmail.com wrote: 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

Re: [PHP] Function mktime() documentation question

2012-03-08 Thread Charles
On Fri, Mar 9, 2012 at 9:23 AM, Tedd Sperling tedd.sperl...@gmail.com wrote: On Mar 8, 2012, at 6:53 PM, Daniel Brown wrote: On Mar 8, 2012 6:14 PM, Tedd Sperling tedd.sperl...@gmail.com wrote: Side-point: I find it interesting that getdate() has all sorts of neat descriptions for the

RE: [PHP] Function mktime() documentation question

2012-03-07 Thread admin
Tedd, This area was always a little grey to me. I have used -1 to obtain the previous months for some time now. 0 always indicated the beginning index of the current month but the explanation never seemed to fit the bill. Having worked extensively in time manipulation in many of the

Re: [PHP] Function mktime() documentation question

2012-03-07 Thread Daniel Brown
On Wed, Mar 7, 2012 at 15:03, Tedd Sperling tedd.sperl...@gmail.com wrote: Hi gang: I am using the getdate(mktime()) functions to get month data (i.e., name of month, first weekday, last day, number of days). To get the number of days for a specific month, I use: // $current_month is the

Re: [PHP] Function mktime() documentation question

2012-03-07 Thread shiplu
To get the number of days for a specific month, I use: // $current_month is the month under question $next_month = $current_month + 1; I use this $next_month = $current_month + 1; $next_month_1= mktime(0, 0, 0, $next_month, 1, date(Y) ); $current_month_1= mktime(0, 0, 0,

Re: [PHP] Function mktime() documentation question

2012-03-07 Thread Simon Schick
Hi, All To bring a work-around into this discussion I myself would not see it as a good way to do it like that - even if the documentation provides some information around that. Here's what I have done in all new projects I worked with time-calculation: @Tedd: Lets pick up your first example and

Re: [PHP] Function mktime() documentation question

2012-03-07 Thread Charles
On Thu, Mar 8, 2012 at 7:01 AM, Simon Schick simonsimc...@googlemail.com wrote: $date = new DateTime($year . '-' . $current_month . '-1'); $date-add( new DateInterval( 'P1M' ) ); // Add a period of 1 month to the date-instance (haven't tried that with the 30th of Jan ... would be kind-of