Try this function to generate a listbox of any number of years, starting with a current year.
Years before a current year will not be displayed in the list of options. The function can be used on a form to enter credit card info.
<?php
function list_years ( $list_name , $num_years , $sel_year = '' ) {
$list .= "<select name= $list_name >\n" ;
if ( $sel_year == '' ) $list .= "<option value=''>Year</option>\n" ;
$year = date ( "Y" ); //get current year
for ( $k = 0 ; $k < $num_years ; ++ $k ) {
if ( $sel_year == $year ) $list .= "<option value= $year selected> $year </option>\n" ;
else $list .= "<option value= $year > $year </option>\n" ;
$year += 1 ;
}
$list .= "</select>\n" ;
echo $list ;
}
/* function call examples */
list_years ( "cc_year" , 10 );
list_years ( "cc_year" , 10 , 2005 );
?>
Functions used to define a schedule of holidays. Can define non-fixed holidays (eg. 3rd sunday of June). Categories : Calendar , Date Time , PHP PHP Calendar Categories : PHP , Calendar , Date Time , Java Script , CSS calculus of the eastersunday Categories : BC math , PHP , Date Time , Databases Select with current month Categories : PHP , HTML and PHP , Date Time , Arrays PHP Round Clock - Must have Gif support to use this. Categories : PHP , Date Time , Graphics This script contains 2 functions: 1 to create html select object based on your own customer date format entry- "M d Y h:i.... etc". The second function processes the select object on submit back to unix time. Categories : PHP , Calendar , Date Time , HTML and PHP Website colour changer Categories : PHP , HTML and PHP , Date Time Calendar, Kalender, date, time, day, month, year Categories : PHP , Date Time , Calendar List people whose birthdays fall on the current Day and Month
Categories : Databases , Date Time , MySQL , PHP Validator - A PHP class that can can be used for validating Email IDs and Dates Categories : PHP , PHP Classes , Data Validation , Email , Date Time In Mysql, the 'datetime' data type is used to store date that looks like '2007-10-16 16:26:30'. we are going to design a function called mysqldate() that takes a mysql date and output format as input and outputs a well formated date. Categories : PHP , Date Time , Databases , MySQL A simple and fast calendar combining PHP and tables. Use this as a base for applications in which a calendar is needed. Categories : Date Time , PHP , Complete Programs , Calendar Calendar using Date function Categories : HTML and PHP , PHP , Date Time , Calendar Data Retrieve from Mysql using AJAX with PHP Categories : PHP , AJAX , Date Time , Databases , MySQL A Timing Class Categories : PHP , PHP Classes , Date Time