UName10
asked on
Day name function showing numeric values
I've got the function with the day name, hour and minute in one, but the day name is a numeric value.
I'm currently getting 1-7 for the day name, 00-23 for hours and 00-29 for minutes.
I need to have the day name as Monday etc (not numeric).
This is the function:
And here's where I call it in:
Any help much appreciated.
I'm currently getting 1-7 for the day name, 00-23 for hours and 00-29 for minutes.
I need to have the day name as Monday etc (not numeric).
This is the function:
Public Sub CreateDayNameTimeSelectionBox(strObjectName, dtCurrentDateTime, AllowNone)
Dim idayName
Dim iHour
Dim iMin
Dim i
Dim strSelected
if dtCurrentDateTime = "0" then
dtCurrentDateTime = Now()
end if
If IsNull(dtCurrentDateTime) then
idayName = ""
iHour = ""
iMin = ""
Else
dtCurrentDateTime = CDate(dtCurrentDateTime)
idayName = WeekdayName(dtCurrentDateTime)
iHour = Hour(dtCurrentDateTime)
iMin = Minute(dtCurrentDateTime)
End If
%>
<select name="<% = strObjectName %>_dayName" ID="Select1" class="input-list">
<%
If AllowNone = True then
%><option value=""> - </option><%
end if
For i = 1 to 7
if i = idayName then
strSelected = " SELECTED "
else
strSelected = ""
end if
%><option value="<% = i %>"<% = strSelected %>><% = i %></option><%
Next
%>
</select>
<select name="<% = strObjectName %>_Hour" class="input-list">
<%
If AllowNone = True then
%><option value=""> - </option><%
End if
For i = 0 to 23
if i = iHour then
strSelected = " SELECTED "
Else
strSelected = ""
end if
%><option value="<% = Right("00" & Trim(CStr(i)), 2) %>" <% = strSelected %>><% = Right("00" & Trim(CStr(i)), 2) %></option><%
Next
%>
</select>
<select name="<% = strObjectName %>_Min" class="input-list">
<%
If AllowNone = True then
%><option value=""> - </option><%
End if
For i = 0 to 59
if i = iMin then
strSelected = " SELECTED "
Else
strSelected = ""
end if
%><option value="<% = Right("00" & Trim(CStr(i)), 2) %>" <% = strSelected %>><% = Right("00" & Trim(CStr(i)), 2) %></option><%
Next
%>
</select>
<%
End Sub
And here's where I call it in:
<% CreateDayNameTimeSelectionBox "OpenHours", NULL, False %>
Any help much appreciated.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Perfect
ASKER
It's ok - I think they need to be separate so I'll just to that...
Thanks again.
Thanks again.
ASKER
Do you know how I can get all day selects listed in one line instead of creating seven separate drop downs?
E.g.
Open in new window
Many thanks for the help and I'll accept the solution now.