I'm creating a script that an admin have to set the interval of minutes to choose . Like 2 by 2, 3 by 3 and so on..
I decided to create a field called "hour" and a field called "minutes" as a string format
In this script, the user have to select the hour and minutes that he started to do a task, and the hour and minutes that he finalized the task, and a briefing of he did in that time.
I have to make a math expression to calculate how much hours he worked in the task. If it were data/time field , it would be very easy to do it.. but they are string fields.. does anyone has any suggestion ??
Comments
:
: I decided to create a field called "hour" and a field called "minutes" as a string format
:
: In this script, the user have to select the hour and minutes that he started to do a task, and the hour and minutes that he finalized the task, and a briefing of he did in that time.
:
: I have to make a math expression to calculate how much hours he worked in the task. If it were data/time field , it would be very easy to do it.. but they are string fields.. does anyone has any suggestion ??
:
:
LIKE THIS OR???
<%
Function CallTimeSeconds(StartTime,EndTime)
StartHour = Hour(StartTime)
StartMin = Minute(StartTime)
StartSec = Second(StartTime)
EndHour = Hour(EndTime)
EndMin = Minute(EndTime)
EndSec = Second(EndTime)
StartingSeconds = (StartSec + (StartMin * 60) + ((StartHour * 60)*60))
EndingSeconds = (EndSec + (EndMin * 60) + ((EndHour * 60)*60))
CallTimeSeconds = EndingSeconds - StartingSeconds
End Function
IF Request.Form("Btn")<>"" THEN
HStart=Request.Form("HStart")
MStart=Request.Form("MStart")
HEnd=Request.Form("HEnd")
MEnd=Request.Form("MEnd")
StartTime=HStart&":"&MStart&":00"
EndTime= HEnd&":"&MEnd&":00"
S=CallTimeSeconds(StartTime,EndTime)
M=S/60
H=M/60
Response.write S&" s
"
Response.write M&" minutes
"
Response.write H&" hour
"
END IF
%>
00
01
02
03
04
05
06
07
08
09
10
11
12
13
14
15
16
17
18
19
20
21
22
23
00
05
10
15
20
25
30
35
40
45
50
55
00
01
02
03
04
05
06
07
08
09
10
11
12
13
14
15
16
17
18
19
20
21
22
23
00
05
10
15
20
25
30
35
40
45
50
55
/haxme
Exactly !! Thanks a lot !!
Another question... some hours the result is like: 1,236777 hours..
how can I make like 1 hour ?
another thing..
when the difference is like 10 hours, it returns sth like 10 hours, 540 minutes..
i'd like sth like 10 hours 0 mins
: : I'm creating a script that an admin have to set the interval of minutes to choose . Like 2 by 2, 3 by 3 and so on..
: :
: : I decided to create a field called "hour" and a field called "minutes" as a string format
: :
: : In this script, the user have to select the hour and minutes that he started to do a task, and the hour and minutes that he finalized the task, and a briefing of he did in that time.
: :
: : I have to make a math expression to calculate how much hours he worked in the task. If it were data/time field , it would be very easy to do it.. but they are string fields.. does anyone has any suggestion ??
: :
: :
: LIKE THIS OR???
: <%
: Function CallTimeSeconds(StartTime,EndTime)
: StartHour = Hour(StartTime)
: StartMin = Minute(StartTime)
: StartSec = Second(StartTime)
: EndHour = Hour(EndTime)
: EndMin = Minute(EndTime)
: EndSec = Second(EndTime)
: StartingSeconds = (StartSec + (StartMin * 60) + ((StartHour * 60)*60))
: EndingSeconds = (EndSec + (EndMin * 60) + ((EndHour * 60)*60))
: CallTimeSeconds = EndingSeconds - StartingSeconds
: End Function
:
:
:
: IF Request.Form("Btn")<>"" THEN
: HStart=Request.Form("HStart")
: MStart=Request.Form("MStart")
: HEnd=Request.Form("HEnd")
: MEnd=Request.Form("MEnd")
: StartTime=HStart&":"&MStart&":00"
: EndTime= HEnd&":"&MEnd&":00"
:
: S=CallTimeSeconds(StartTime,EndTime)
: M=S/60
: H=M/60
:
: Response.write S&" s"
: Response.write M&" minutes"
: Response.write H&" hour"
: END IF
: %>
:
:
:
:
:
:
: 00
: 01
: 02
: 03
: 04
: 05
: 06
: 07
: 08
: 09
: 10
: 11
: 12
: 13
: 14
: 15
: 16
: 17
: 18
: 19
: 20
: 21
: 22
: 23
:
:
: 00
: 05
: 10
: 15
: 20
: 25
: 30
: 35
: 40
: 45
: 50
: 55
:
:
:
: 00
: 01
: 02
: 03
: 04
: 05
: 06
: 07
: 08
: 09
: 10
: 11
: 12
: 13
: 14
: 15
: 16
: 17
: 18
: 19
: 20
: 21
: 22
: 23
:
:
: 00
: 05
: 10
: 15
: 20
: 25
: 30
: 35
: 40
: 45
: 50
: 55
:
:
:
: /haxme
:
:
:
:
: Exactly !! Thanks a lot !!
:
: Another question... some hours the result is like: 1,236777 hours..
:
: how can I make like 1 hour ?
:
<%=FormatNumber(1,236777 , 1)%>
: another thing..
: when the difference is like 10 hours, it returns sth like 10 hours, 540 minutes..
:
: i'd like sth like 10 hours 0 mins
:
IF Request.Form("Btn")<>"" THEN
HStart=Request.Form("HStart")
MStart=Request.Form("MStart")
HEnd=Request.Form("HEnd")
MEnd=Request.Form("MEnd")
StartTime=HStart&":"&MStart&":00"
EndTime= HEnd&":"&MEnd&":00"
S=CallTimeSeconds(StartTime,EndTime)
M=S/60
H=M/60
HPart=INT(H)
MinutesLeft=M-(60*HPart)
'Response.write S&" s
"
'Response.write M&" minutes
"
Response.write HPart&" hour and " &MinutesLeft& " minutes
"
END IF
/haxme
:
: : : I'm creating a script that an admin have to set the interval of minutes to choose . Like 2 by 2, 3 by 3 and so on..
: : :
: : : I decided to create a field called "hour" and a field called "minutes" as a string format
: : :
: : : In this script, the user have to select the hour and minutes that he started to do a task, and the hour and minutes that he finalized the task, and a briefing of he did in that time.
: : :
: : : I have to make a math expression to calculate how much hours he worked in the task. If it were data/time field , it would be very easy to do it.. but they are string fields.. does anyone has any suggestion ??
: : :
: : :
: : LIKE THIS OR???
: : <%
: : Function CallTimeSeconds(StartTime,EndTime)
: : StartHour = Hour(StartTime)
: : StartMin = Minute(StartTime)
: : StartSec = Second(StartTime)
: : EndHour = Hour(EndTime)
: : EndMin = Minute(EndTime)
: : EndSec = Second(EndTime)
: : StartingSeconds = (StartSec + (StartMin * 60) + ((StartHour * 60)*60))
: : EndingSeconds = (EndSec + (EndMin * 60) + ((EndHour * 60)*60))
: : CallTimeSeconds = EndingSeconds - StartingSeconds
: : End Function
: :
: :
: :
: : IF Request.Form("Btn")<>"" THEN
: : HStart=Request.Form("HStart")
: : MStart=Request.Form("MStart")
: : HEnd=Request.Form("HEnd")
: : MEnd=Request.Form("MEnd")
: : StartTime=HStart&":"&MStart&":00"
: : EndTime= HEnd&":"&MEnd&":00"
: :
: : S=CallTimeSeconds(StartTime,EndTime)
: : M=S/60
: : H=M/60
: :
: : Response.write S&" s"
: : Response.write M&" minutes"
: : Response.write H&" hour"
: : END IF
: : %>
: :
: :
: :
: :
: :
: :
: : 00
: : 01
: : 02
: : 03
: : 04
: : 05
: : 06
: : 07
: : 08
: : 09
: : 10
: : 11
: : 12
: : 13
: : 14
: : 15
: : 16
: : 17
: : 18
: : 19
: : 20
: : 21
: : 22
: : 23
: :
: :
: : 00
: : 05
: : 10
: : 15
: : 20
: : 25
: : 30
: : 35
: : 40
: : 45
: : 50
: : 55
: :
: :
: :
: : 00
: : 01
: : 02
: : 03
: : 04
: : 05
: : 06
: : 07
: : 08
: : 09
: : 10
: : 11
: : 12
: : 13
: : 14
: : 15
: : 16
: : 17
: : 18
: : 19
: : 20
: : 21
: : 22
: : 23
: :
: :
: : 00
: : 05
: : 10
: : 15
: : 20
: : 25
: : 30
: : 35
: : 40
: : 45
: : 50
: : 55
: :
: :
: :
: : /haxme
: :
: :
: :
: :
:
:
:
: