How would you...

1. Senior Member
Join Date
Dec 1969
Posts
214

## How would you...

hi,<BR><BR>I want to try something but I&#039;m not sure how to go about it.<BR>What I would like to do is have numbers go from 1 to 10 and have them look like hours.On top of that I&#039;d like to include the half hours. I know how to do the first part with a "for to" statement.<BR>ie:<BR>&#060;%For nhour = 1 to 20<BR>if nhour &#060; then 10 then<BR>strnhour = "0" & nhour & ":00"<BR>else<BR>strnhour = nhour& ":00" <BR>end if%&#062;<BR><BR>So strnhour would give me 01:00 02:00 03:00 etc to 20:00. Now does anyone know how I could incorporate half hours in to that so that I&#039;d get 01:00 01:30 02:00 02:30 03:00 03:30 etc to 20:00<BR><BR>thanks for your help,<BR>Claire

2. Senior Member
Join Date
Dec 1969
Posts
11,247

## RE: How would you...

&#060;%For nhour = 1 to 20<BR>if nhour &#060; then 10 then<BR>strnhour = strnhour & "0" & nhour & ":00 0" & nhour & ":30"<BR>else<BR>strnhour = strnhour & nhour& ":00 " & nhour& ":30"<BR>end if%&#062;

3. Senior Member
Join Date
Dec 1969
Posts
1,843

## RE: How would you...

I&#039;m confused.. do you want hours to go from one to ten, or one to twenty?<BR><BR>For nHour = 1 to 10<BR> strnHour = "0" & nhour & ":00"<BR> strnHalfHour = "0" & nhour & ":30"<BR> <BR> If nHour &#060; 10 Then<BR> StrnHour = "0" & strnHour<BR> StrnHalfHour = "0" & strnHour<BR> End If<BR>Next<BR><BR>Will that work? I&#039;m not sure what you&#039;re trying to do with these numbers, so I&#039;m not sure if having 2 variables like that will work for you....

4. Member
Join Date
Dec 1969
Posts
77

## RE: How would you...

Try this out:<BR>&#060;%<BR>For nhour = 1 To 20 <BR><BR>y=0<BR><BR> Do Until y = 2<BR> If var = 1 Then <BR> half = ":30"<BR> var = 2<BR> Else <BR> half = ":00"<BR> var = 1<BR> End If<BR> If nhour &#060; 10 Then strnhour = "0" & nhour & half Else strnhour = nhour & half End If <BR> response.write strnhour &"&#060;/br&#062;"<BR> y = y + 1<BR> Loop<BR><BR>Next<BR>%&#062; <BR>

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•