|
-
Sep 24th, 2008, 10:29 PM
#1
Thread Starter
Junior Member
-
Sep 24th, 2008, 10:36 PM
#2
Re: Convert HH:MM into seconds
Convert it to datetime data type using CDATE() or TimeSerial() functions then get number of seconds elapsed using DateDiff() function.
msgbox datediff("s", 0, time) 'sample using built in function time that returns current time
Please take note of the duration you are testing as dates are represented internally as numbers with the whole number portion as the number of days and the decimal portion the part of a day, e.g. half a day is 0.5.
msgbox datediff("s", 0, now) 'seconds since min date supported
msgbox datediff("s", date, now) 'seconds since midnight
-
Sep 24th, 2008, 10:39 PM
#3
Re: Convert HH:MM into seconds
Code:
dim MyDate as Date
dim X as long
MyDate = cdate(text1.text)
X = (datepart("h",MyDate) * 3600) + (datepart("n",MyDate) * 60) + datepart("s",MyDate)
-
Sep 24th, 2008, 11:06 PM
#4
Thread Starter
Junior Member
Re: Convert HH:MM into seconds
thanks a lot for your time leinad31 & longwolf
with the correct terms i must walk the correct path.
let me try and get back to ya all
-
Sep 24th, 2008, 11:14 PM
#5
Re: Convert HH:MM into seconds
Another way:
Code:
s = CDate(Text1.Text) * 86400 '-- 24*60*60 = 86400
-
Sep 24th, 2008, 11:37 PM
#6
Re: Convert HH:MM into seconds
 Originally Posted by anhn
Another way:
Code:
s = CDate(Text1.Text) * 86400 '-- 24*60*60 = 86400
Coool!!!
-
Sep 24th, 2008, 11:42 PM
#7
Thread Starter
Junior Member
Re: Convert HH:MM into seconds
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|