Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 432253
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T20:03:22+00:00 2026-05-12T20:03:22+00:00

Does anyone know of a way to do this? Im sure its been done

  • 0

Does anyone know of a way to do this? Im sure its been done before.

Need to generate html downdown lists, and fill in the month, day, year, and then the hour, and minute fields. I only need the MM/DD/YYYY to display current (where those values match current, mark that option selected). I wouldnt even know where to start. I assume looping through something with the date function? Im lost here.

edit
all months, days 1-31, and the current year, plus 6 years into the future.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T20:03:22+00:00Added an answer on May 12, 2026 at 8:03 pm

    two selects example:

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
      "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
    <head>
      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
      <meta http-equiv="Content-Language" content="en" />
      <title>Test</title>
    </head>
    <body>
      <form>
        <fieldset>
          <legend></legend>
          <label for="date">date : </label>
          <select id="date" name="date" title="Peek a date">
          <?php
            $beg = new DateTime();
            $end = new DateTime();
            $end->modify("+6 years");
    
            while($beg->format("U") <= $end->format("U")) {
              $d = $beg->format("d/m/Y");
              echo "<option value='" . $d . "'" . (date("d/m/Y") == $d ? " selected='selected'" : "") . ">" . $d . "</option>\n";
              $beg->modify("+1 day");
            }
          ?>
          </select>
          <label for="time">time : </label>
          <select id="time" name="time" title="Peek a time">
          <?php
            foreach(range(0, 24) as $h) {
              foreach(range(0, 59) as $m) {
                $t = sprintf("%02d:%02d", $h, $m);
                echo "<option value='" . $t . "'" . (date("H:i") == $t ? " selected='selected'" : "") . ">" . $t . "</option>\n";
              }
            }
          ?>
          </select>
    </body>
    </html>
    

    or with jQuery UI datepicker (more friendly IMHO):

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
      "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr">
    <head>
      <title>Test</title>
      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
      <meta http-equiv="Content-Language" content="en" />
      <script type="text/javascript" src="includes/js/jquery-1.3.2.min.js"></script>
      <script type="text/javascript" src="includes/js/jquery-ui-1.7.2.custom.min.js"></script>
      <link rel="stylesheet" type="text/css" href="includes/js/themes/ui-lightness/jquery-ui-1.7.2.custom.css" media="screen, print" />
      <script type="text/javascript">
      $(document).ready(function() {
        var d = new Date();
    
        $("#date").datepicker({
          minDate: d,
          maxDate: new Date(d.getFullYear() + 6, d.getMonth(), d.getDay()),
          dateFormat: "dd/mm/yy",
          mandatory: true,
          changeFirstDay: false,
          changeYear: true,
          showStatus: true,
          showOn: "both",
          buttonImage: "images/calendar.gif",
          buttonImageOnly: true
        }).addClass("embed");
      });
      </script>
    </head>
    <body>
      <form>
        <fieldset>
          <legend></legend>
          <label for="date">date : </label>
          <input type="text" name="date" id="date" />
          &nbsp;&nbsp;
          <label for="time">time : </label>
          <select id="time" name="time" title="Peek a time">
          <?php
            foreach(range(0, 24) as $h) {
              foreach(range(0, 59) as $m) {
                $t = sprintf("%02d:%02d", $h, $m);
                echo "<option value='" . $t . "'" . (date("H:i") == $t ? " selected='selected'" : "") . ">" . $t . "</option>\n";
              }
            }
          ?>
          </select>
    </body>
    </html>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This looks like a long shot, but does anyone know of a way to:
Does anyone know a way to determine if a Rails association has been eager
Does anyone know of a way to contain a nonbreaking space in an html
Does anyone know of an easy way to escape HTML from strings in jQuery
Does anyone know a way to register a persistent UDF in SQLite 3 (using
Does anyone know a way to get the mean amplitude of a .wav file
Does anyone know a way to get Firefox to crop the corners if the
Does anyone know of any way to overcome NotSupportedException? I have a method against
does anyone know of a way to format the date that is returned from
Does anyone know of a way I can setup a VLAN for my Android

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.