Date - drop down menu

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Slickuser

    Date - drop down menu

    Hi,

    I would like to use date() function show in the drop down menu start
    from today to next 1 Month.

    So it will be something like this.

    4/3/2008
    4/4/2008
    4/5/2008
    .......
    5/12008
    5/2/2008
    5/3/2008

    Any idea? thanks
  • =?iso-8859-1?Q?=C1lvaro?= G. Vicario

    #2
    Re: Date - drop down menu

    *** Slickuser escribió/wrote (Fri, 4 Apr 2008 12:55:12 -0700 (PDT)):
    I would like to use date() function show in the drop down menu start
    from today to next 1 Month.
    >
    So it will be something like this.
    >
    4/3/2008
    4/4/2008
    4/5/2008
    ......
    5/12008
    5/2/2008
    5/3/2008
    Not fully tested but it should work:

    <?php

    $now = time();
    $next_month = strtotime('+1 month', $now);

    for($i=$now; $i<$next_month; $i=strtotime('+ 1 day', $i)){
    echo date('Y-m-d', $i) . "\n";
    }

    ?>

    Adjust the format of the echo line to your liking.


    --
    -- http://alvaro.es - Álvaro G. Vicario - Burgos, Spain
    -- Mi sitio sobre programación web: http://bits.demogracia.com
    -- Mi web de humor en cubitos: http://www.demogracia.com
    --

    Comment

    • Krustov

      #3
      Re: Date - drop down menu

      <comp.lang.ph p>
      <Slickuser>
      <Fri, 4 Apr 2008 12:55:12 -0700 (PDT)>
      <69a9f1a9-2995-4c84-a7aa-cab802a29c35@q1 0g2000prf.googl egroups.com>
      I would like to use date() function show in the drop down menu start
      from today to next 1 Month.
      >
      So it will be something like this.
      >
      4/3/2008
      4/4/2008
      4/5/2008
      ......
      5/12008
      5/2/2008
      5/3/2008
      >
      $rambo=1; $nuke=0;
      while ($rambo<31)
      {
      $kill[$rambo]=date("D dS M",time()+$nuke );
      $nuke=$nuke+386 400;
      $rambo=$rambo+1 ;
      }

      Untested - but something like this will generate 31 dates .


      --

      Comment

      • Jerry Stuckle

        #4
        Re: Date - drop down menu

        Slickuser wrote:
        Hi,
        >
        I would like to use date() function show in the drop down menu start
        from today to next 1 Month.
        >
        So it will be something like this.
        >
        4/3/2008
        4/4/2008
        4/5/2008
        ......
        5/12008
        5/2/2008
        5/3/2008
        >
        Any idea? thanks
        >
        Several ways to do it, but how about:

        for ($i = 0; $i = 30; $i++)
        echo "date('m/d/Y',strtotime("n ow + $i days"));

        Add your html as necessary.

        --
        =============== ===
        Remove the "x" from my email address
        Jerry Stuckle
        JDS Computer Training Corp.
        jstucklex@attgl obal.net
        =============== ===

        Comment

        • nospam

          #5
          Re: Date - drop down menu

          Slickuser wrote:
          Hi,
          >
          I would like to use date() function show in the drop down menu start
          from today to next 1 Month.
          >
          So it will be something like this.
          >
          4/3/2008
          4/4/2008
          4/5/2008
          ......
          5/12008
          5/2/2008
          5/3/2008
          >
          Any idea? thanks
          How about use some javascript gadgets?


          --
          Xu, Qian (stanleyxu)

          Comment

          • Jerry Stuckle

            #6
            Re: Date - drop down menu

            nospam wrote:
            Slickuser wrote:
            >Hi,
            >>
            >I would like to use date() function show in the drop down menu start
            >from today to next 1 Month.
            >>
            >So it will be something like this.
            >>
            >4/3/2008
            >4/4/2008
            >4/5/2008
            >......
            >5/12008
            >5/2/2008
            >5/3/2008
            >>
            >Any idea? thanks
            >
            How about use some javascript gadgets?

            >
            Why? PHP does it quite well - and doesn't require JS to be enabled on
            the browser.

            --
            =============== ===
            Remove the "x" from my email address
            Jerry Stuckle
            JDS Computer Training Corp.
            jstucklex@attgl obal.net
            =============== ===

            Comment

            Working...