Date Time Code

  Home arrow Date Time Code arrow Display Date Function
DATE TIME CODE

Display Date Function
By: Codewalkers
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 1
    2003-07-14

    Table of Contents:

     
     

    SEARCH CODEWALKERS

    You can manipulate many variables in the function.

    By : cds4654

    /*Displays out date variables in three select boxes inside a <td></td>*/
    <?php
    print "<html>";
    print "<body>";

    print "<table>";
    print "<tr>";

    get_dates("2","left", "000000", "From", "nm_f", "nd_f", "ny_f");

    print "</tr>";
    print "</table>";
    print "</body>";
    print "</html>";
    ?>
    <?php
    function get_dates($col="", $ali="", $color="", $f_t="", $nm_f="", $nd_f="", $ny_f="")
    {
    if (empty($nm_f)){$nm_f.="month_f";}
    if (empty($nd_f)){$nd_f.="date_f";}
    if (empty($ny_f)){$ny_f.="year_f";}

    $months = array("January","February","March","April","May","June","July",
    "August","September","October","November","December");
    print "<td align=\"$ali\" colspan=\"$col\">";
    print "<font color=\"#$color\"><b>$f_t: </b></font>";
    //print "</td>";
    //print "<td>";
    print "<select name=\"$nm_f\"";
    for ($x_f=0; $x_f<=count($months); $x_f++)
    {
    print "\t<option value=\"$x_f\">".$months[$x_f-1]."\n";
    reset($months);
    }
    print "</select>";
    //print "</td>";
    //print "<td>";
    print "<select name=\"$nd_f\"";
    for ($d_f=0; $d_f<32; $d_f++)
    {
    print "\t<option value=\"$d_f\">".$d_f."\n";
    }
    print "</select>";
    //print "</td>";
    //print "<td>";
    print "<select name=\"$ny_f\"";
    for ($y_f=1999; $y_f<2016; $y_f++)
    {
    print "\t<option value=\"$y_f\">".$y_f."\n";
    }
    print "</select>";
    print "</td>";
    }
    ?>

    DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware.

    More Date Time Code Articles
    More By Codewalkers

    blog comments powered by Disqus

    DATE TIME CODE ARTICLES

    - DaysInSpan.php
    - MySQLdateSpan.php
    - DateSpan.php
    - FutureDateFormEntry.php
    - Generate Time Option List for Select stateme...
    - Current Age Script (v2)
    - class for some mysql imitated time functions
    - Current Age Script, up to the last day
    - filemtime_remote
    - Page Generation Time Figure-Outer
    - convGMT v2
    - Benchmarker
    - Simple PHP Calendar
    - Display message according to hour of day
    - Display Date Function

    Developer Shed Affiliates

     



    © 2003-2017 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap