msqueen082
Junior Member
Hi
I am trying to format a time display it in a label.. I am challenging visual basic this quarter in school and it is kicking my butt :\
Can you please help me out in the following code..It is for a homework assignment
[/SIZE]
I am trying to format a time display it in a label.. I am challenging visual basic this quarter in school and it is kicking my butt :\
Can you please help me out in the following code..It is for a homework assignment
Code:
[SIZE=2][/SIZE][SIZE=2][COLOR=#008000][SIZE=2][COLOR=#008000]'============================FormatTime=============================
[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][/SIZE][SIZE=2][COLOR=#008000][SIZE=2][COLOR=#008000]'given - an integer representing a valid military
[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][/SIZE][SIZE=2][COLOR=#008000][SIZE=2][COLOR=#008000]' task - convert the military time into standard hh:mm am/pm
[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][/SIZE][SIZE=2][COLOR=#008000][SIZE=2][COLOR=#008000]' return - a string containing the time in hh:mm am/pm format
[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]Dim[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] sTime [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]String
[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]Dim[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] eTime [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]String
[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]
sTime = [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]integer[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2].parse(txtStart.text)
eTime = [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]integer[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2].parse(txtEnd.text)
lblStart.text = format ([/SIZE][SIZE=2][COLOR=#a31515][SIZE=2][COLOR=#a31515]"h"[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] & [/SIZE][SIZE=2][COLOR=#a31515][SIZE=2][COLOR=#a31515]":"[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] & [/SIZE][SIZE=2][COLOR=#a31515][SIZE=2][COLOR=#a31515]"mm"[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] & tt[/SIZE][SIZE=2][COLOR=#a31515][SIZE=2][COLOR=#a31515]")
[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]lblStart.text = Format([/SIZE][SIZE=2][COLOR=#a31515][SIZE=2][COLOR=#a31515]"h"[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] & [/SIZE][SIZE=2][COLOR=#a31515][SIZE=2][COLOR=#a31515]":"[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] & [/SIZE][SIZE=2][COLOR=#a31515][SIZE=2][COLOR=#a31515]"mm"[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] & [/SIZE][SIZE=2][COLOR=#a31515][SIZE=2][COLOR=#a31515]":"[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] & [/SIZE][SIZE=2][COLOR=#a31515][SIZE=2][COLOR=#a31515]"tt"[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2])[/SIZE]
[SIZE=2][/SIZE]
[SIZE=2]