OOOOOOOps!

I got my stuff from the annotated manual - that'll teach me.

Chris

Tomasz Abramowicz wrote:

> ahem
> $daysinmonth = date('t');
>
> ----- Original Message -----
> From: "Chris Fry" <[EMAIL PROTECTED]>
> To: "Jon Rosenberg" <[EMAIL PROTECTED]>
> Cc: "PHP List" <[EMAIL PROTECTED]>
> Sent: Wednesday, May 02, 2001 3:06 AM
> Subject: Re: [PHP] date list
>
> > Jon,
> >
> > Just had to do almost exactly this - here's one solution. The tricky bit
> was
> > getting the number of days in the month - you have to look at next month!
> >
> > This generates a list for 12 months starting with the current month and
> outputs
> > display stuff as well. In our scenario this is passed to a script which
> grabs
> > records from a database and produces a report for the month selected and
> the
> > previous month so the range of values is always for 2 months. Ours goes
> > backwards - you'll need to adjust it to run forwards.
> >
> >   <select name="strReportMonth" size="1">
> >   <? // Get This Month
> >    $strThisMonth = date('m');
> >    $strThisYear = date('Y');
> >    // convert to integer
> >    $strThisMonth++;
> >    $strNextMonth = $strThisMonth;
> >    $strPrevYear = $strThisYear;
> >    for($i=0;$i<=12;$i++) {
> >     $strThisMonth--;
> >     if($strNextMonth == 0) {
> >      $strNextMonth = 12;
> >     }
> >     if($strNextMonth == 13) {
> >      $strNextMonth = 1;
> >     }
> >     // How many days in this month
> >     $lastday = mktime (0,0,0,$strNextMonth,0,$strThisYear);
> >     $last = strftime ("%d", $lastday);
> >     $strThisMonthTS = mktime (0,0,0,$strNextMonth,0,$strThisYear);
> >     $strThisMonthName = strftime ("%B", $strThisMonthTS);
> >     $strNextMonth--;
> >     if($strThisMonth == 0) {
> >      $strThisMonth = 12;
> >      $strThisYear--;
> >     }
> >     $strPrevMonth = $strThisMonth -1;
> >     if($strPrevMonth == 0) {
> >      $strPrevMonth = 12;
> >      $strPrevYear--;
> >     }
> >     $strPrevMonthTS = mktime (0,0,0,$strThisMonth,0,$strPrevYear);
> >     $strPrevMonthName = strftime ("%B", $strPrevMonthTS);
> >     if($strPrevMonth < 10) {
> >      $strPrevMonth = "0".$strPrevMonth;
> >     }
> >     if($strThisMonth < 10) {
> >      $strThisMonth = "0".$strThisMonth;
> >     }
> >     ?>
> >     <option value="<? print
> >
> $strPrevMonth."/01/".$strPrevYear."|".$strThisMonth."/".$last."/".$strThisYe
> ar."|".$strThisMonthName."|".$strThisYear."|".$strPrevMonth."|".$strThisMont
> h."|".$strPrevMonthName."|".$strPrevYear;
> > ?>"><? print $strThisMonthName." ".$strThisYear; ?>
> >     <?
> >    }
> >   ?>
> >   </select>
> >
> >
> > Jon Rosenberg wrote:
> >
> > > I need to make a select list for a web page in the following format:
> > >
> > > 01/01/01-01/07/01
> > > 01/08/01-01/14/01
> > > 01/15/01-01/21/01
> > > etc
> > > etc
> > > till the end of 2002 and further in the future eventually
> > >
> > > I'd like to make PHP generate this for me so I don't have to handcode it
> for
> > > each year in the future.  I've looked at the date/time functions and I'm
> a
> > > bit confused.  Any help would be appreciated.  Thanks!
> > >
> > > Jon
> > >
> > > --
> > > PHP General Mailing List (http://www.php.net/)
> > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > For additional commands, e-mail: [EMAIL PROTECTED]
> > > To contact the list administrators, e-mail: [EMAIL PROTECTED]
> >
> > --
> > Chris Fry
> > Quillsoft Pty Ltd
> > Specialists in Secure Internet Services and E-Commerce Solutions
> > 10 Gray Street
> > Kogarah
> > NSW  2217
> > Australia
> >
> > Phone: +61 2 9553 1691
> > Fax: +61 2 9553 1692
> > Mobile: 0419 414 323
> > eMail: [EMAIL PROTECTED]
> > http://www.quillsoft.com.au
> >
> > You can download our Public CA Certificate from:-
> > https://ca.secureanywhere.com/htdocs/cacert.crt
> >
> > **********************************************************************
> >
> > This information contains confidential information intended only for
> > the use of the authorised recipient.  If you are not an authorised
> > recipient of this e-mail, please contact Quillsoft Pty Ltd by return
> > e-mail.
> > In this case, you should not read, print, re-transmit, store or act
> > in reliance on this e-mail or any attachments, and should destroy all
> > copies of them.
> > This e-mail and any attachments may also contain copyright material
> > belonging to Quillsoft Pty Ltd.
> > The views expressed in this e-mail or attachments are the views of
> > the author and not the views of Quillsoft Pty Ltd.
> > You should only deal with the material contained in this e-mail if
> > you are authorised to do so.
> >
> > This notice should not be removed.
> >
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > To contact the list administrators, e-mail: [EMAIL PROTECTED]
> >
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]

--
Chris Fry
Quillsoft Pty Ltd
Specialists in Secure Internet Services and E-Commerce Solutions
10 Gray Street
Kogarah
NSW  2217
Australia

Phone: +61 2 9553 1691
Fax: +61 2 9553 1692
Mobile: 0419 414 323
eMail: [EMAIL PROTECTED]
http://www.quillsoft.com.au

You can download our Public CA Certificate from:-
https://ca.secureanywhere.com/htdocs/cacert.crt

**********************************************************************

This information contains confidential information intended only for
the use of the authorised recipient.  If you are not an authorised
recipient of this e-mail, please contact Quillsoft Pty Ltd by return
e-mail.
In this case, you should not read, print, re-transmit, store or act
in reliance on this e-mail or any attachments, and should destroy all
copies of them.
This e-mail and any attachments may also contain copyright material
belonging to Quillsoft Pty Ltd.
The views expressed in this e-mail or attachments are the views of
the author and not the views of Quillsoft Pty Ltd.
You should only deal with the material contained in this e-mail if
you are authorised to do so.

This notice should not be removed.



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to