Display hours in select box with am/pm using coldfusion

Display hours in select box with am/pm using coldfusion.

Select Hour :-
<select name="starthour" style="padding:5px;">
    <cfset curtime = TimeFormat(Now(),'HH')>
    <cfset starttime = 00>
    <cfset endtime = 23>
        <cfset endloop = (starttime + endtime)>
        <cfloop from="#starttime#" to="#endloop#" index="hour">
            <cfset showtime = hour & ':00:00'>
            <option value="#hour#"<cfif curtime eq hour> selected="selected"</cfif>>#TimeFormat((showtime),'hh tt')#</option>
        </cfloop>
</select>
</cfoutput>

Comments

Popular posts from this blog

Create CSV file in Coldfusion Using CFFile

Login with facebook using coldfusion

Get Previous One Day Data in Sql Server