{html_select_date}{html_select_date} is a
custom function
that creates date dropdowns.
It can display any or all of year, month, and day.
All parameters that are not in the list below are printed as
name/value-pairs inside the <select> tags of day, month and year.
Attribute NameTypeRequiredDefaultDescriptionprefixstringNoDate_what to prefix the var name withtimetimestamp/YYYY-MM-DDNocurrent time in unix timestamp or YYYY-MM-DD formatwhat date/time to usestart_yearstringNocurrent yearthe first year in the dropdown, either
year number, or relative to current year (+/- N)end_yearstringNosame as start_yearthe last year in the dropdown, either
year number, or relative to current year (+/- N)display_daysbooleanNo&true;whether to display days or notdisplay_monthsbooleanNo&true;whether to display months or notdisplay_yearsbooleanNo&true;whether to display years or notmonth_formatstringNo%Bwhat format the month should be in (strftime)day_formatstringNo%02dwhat format the day output should be in (sprintf)day_value_formatstringNo%dwhat format the day value should be in (sprintf)year_as_textbooleanNo&false;whether or not to display the year as textreverse_yearsbooleanNo&false;display years in reverse orderfield_arraystringNonull
if a name is given, the select boxes will be drawn
such that the results will be returned to PHP in the
form of name[Day], name[Year], name[Month].
day_sizestringNonulladds size attribute to select tag if givenmonth_sizestringNonulladds size attribute to select tag if givenyear_sizestringNonulladds size attribute to select tag if givenall_extrastringNonulladds extra attributes to all select/input tags if givenday_extrastringNonulladds extra attributes to select/input tags if givenmonth_extrastringNonulladds extra attributes to select/input tags if givenyear_extrastringNonulladds extra attributes to select/input tags if givenfield_orderstringNoMDYthe order in which to display the fieldsfield_separatorstringNo\nstring printed between different fieldsmonth_value_formatstringNo%mstrftime format of the month values, default is
%m for month numbers.year_emptystringNonullIf supplied then the first element of the year's select-box has this
value as it's label and as it's value. This is useful to make the
select-box read Please select a year for example.
Note that you can use values like -MM-DD as time-attribute to indicate
an unselected year.month_emptystringNonullIf supplied then the first element of the month's select-box has this
value as it's label and as it's value. .
Note that you can use values like YYYY--DD as time-attribute to indicate
an unselected month.day_emptystringNonullIf supplied then the first element of the day's select-box has this
value as it's label and as it's value.
Note that you can use values like YYYY-MM- as
time-attribute to indicate an unselected day.
There's an useful php function on the
date tips page for converting
{html_select_date} values to a timestamp.
{html_select_date}Template code
This will output:
..... snipped .....
]]>
{html_select_date} second example
With 2000 as the current year the output:
.... snipped ....
]]>
See also
{html_select_time},
date_format,
$smarty.now
and the date tips page.