Try this, oh and i meant the InStr() function not indexOf()
<%
AppTime=60
If Request("App_Time")<>"" then
AppTime =Request("App_Time")
end if
AppBrk=AppTime/60
AppStart=9
If Request("StartTime")<>"" then
AppStart =Request("StartTime")
end if
AppEnd=6
If Request.Form("End_Time")<>"" then
AppEnd =Request.Form("End_Time")
end if
%>
<%
hourCounter = AppStart
AppBrk = 0.5
Do WHILE hourCounter < 12 %>
Hours:
<%
intPosDot = inStr(hourCounter, ".")
if intPosDot = 0 then
Response.Write(hourCounter)
else
strHour = Left(hourCounter, intPosDot-1)
strMinute = Right(hourCounter, len(hourCounter)-intPosDot)
strMinute = "0." & strMinute
strMinute = 60 * strMinute
Response.Write(strHour & ":" & strMinute)
end if
%>
- AM<br>
<% hourCounter = hourCounter + AppBrk
Loop
%>
<%
PMCounter = 0
Do WHILE PMCounter <= AppEnd-AppBrk %>
Hours:
<% If PMCounter<1 Then
intPosDot = inStr(PMCounter, ".")
if intPosDot = 0 then
Response.Write (PMCounter+12)
else
strHour = Left(PMCounter, intPosDot-1)
strMinute = Right(PMCounter, len(PMCounter)-intPosDot)
strMinute = "0." & strMinute
strMinute = 60 * strMinute
Response.Write(strHour & ":" & strMinute)
end if
else
intPosDot = inStr(PMCounter, ".")
if intPosDot = 0 then
Response.Write(PMCounter)
else
strHour = Left(PMCounter, intPosDot-1)
strMinute = Right(PMCounter, len(PMCounter)-intPosDot)
strMinute = "0." & strMinute
strMinute = 60 * strMinute
Response.Write(strHour & ":" & strMinute)
end if
end if%> - PM<br>
<% PMCounter = PMCounter + AppBrk
Loop
%>
"Hans" <Ha**@home.com> wrote in message
news:bu**********@ctb-nnrp2.saix.net...
Thanks Alex,
Not too sure what you mean here, I am testing it with a form to see if it
works OK, the code is as follows:
<%
AppTime=60
If Request("App_Time")<>"" then
AppTime =Request("App_Time")
end if
AppBrk=AppTime/60
AppStart=9
If Request("StartTime")<>"" then
AppStart =Request("StartTime")
end if
AppEnd=6
If Request.Form("End_Time")<>"" then
AppEnd =Request.Form("End_Time")
end if
%>
<%
hourCounter = AppStart
Do WHILE hourCounter < 12 %>
Hours: <%Response.Write(hourCounter)%> - AM<br>
<% hourCounter = hourCounter + AppBrk
Loop
%>
<%
PMCounter = 0
Do WHILE PMCounter <= AppEnd-AppBrk %>
Hours:
<% If PMCounter<1 Then
Response.Write (PMCounter+12)
else Response.Write(PMCounter)
end if%> - PM<br>
<% PMCounter = PMCounter + AppBrk
Loop
%>
How would I use your suggestion?
Thanks
Hans
"Alex Goodey" <ag*****@hsfinancial.co.uk> wrote in message
news:bu************@ID-221525.news.uni-berlin.de... If the variable is a string eg. "11.5" you could use string manipulation
i.e. Left(), Right(), indexOf() to find the certain parts of the value.
then make the calculations on the relevant parts and concatenate the two
strings, to display the time.
"Hans" <Ha**@home.com> wrote in message
news:bu**********@ctb-nnrp2.saix.net... Hi there, I need to create a list (diary style) of times in a day. I
can do this with normal "metricated" break-up of the hours, but need to
display the actual time.
I have a "Starting time" and an ending time as variables. I also have
a "Timespan" for the increment.
For example Start time=8:00 AM
End Time 6:00 PM and increment in 30 minute intervals
I need to convert anything after the decimal point into Minutes. If I
have "11.5" I want to show it as "11.30". I can divide the decimal into 60
to give me the Minute equivalent of the decimal, but need to do this without affecting the "Hour"
The start time, end time and increments will be a variable from a
database. Any help will be much appreciated.
Thanks
Hans