Sep 23, 2004 #1 fabby1 Technical User Mar 9, 2004 206 GB Hi I have an input box that the users enters the number of minutes and seconds to include in a query. I need to convert this date format 04:30c (4 minutes 30 seconds) into the seconds equivalent. Is there a function that will do this ? Thanks Phil
Hi I have an input box that the users enters the number of minutes and seconds to include in a query. I need to convert this date format 04:30c (4 minutes 30 seconds) into the seconds equivalent. Is there a function that will do this ? Thanks Phil
Sep 23, 2004 1 #2 Ed2020 Programmer Nov 12, 2001 1,899 GB Public Function CalcSecs(ByVal strMinsAndSecs As String) As Long Dim intSeconds As Integer Dim intMins As Integer intSeconds = Right(strMinsAndSecs, InStr(1, strMinsAndSecs, ":") - 1) intMins = Left(strMinsAndSecs, InStr(1, strMinsAndSecs, ":") - 1) CalcSecs = (intMins * 60) + intSeconds End Function Please do not feed the trolls..... Upvote 0 Downvote
Public Function CalcSecs(ByVal strMinsAndSecs As String) As Long Dim intSeconds As Integer Dim intMins As Integer intSeconds = Right(strMinsAndSecs, InStr(1, strMinsAndSecs, ":") - 1) intMins = Left(strMinsAndSecs, InStr(1, strMinsAndSecs, ":") - 1) CalcSecs = (intMins * 60) + intSeconds End Function Please do not feed the trolls.....
Sep 23, 2004 Thread starter #3 fabby1 Technical User Mar 9, 2004 206 GB Ed Brilliant, thanks for the help Upvote 0 Downvote
Sep 23, 2004 1 #4 MichaelRed Programmer Dec 22, 1999 8,410 US then, of course, you could get the conversion in a single step - IF (and ONLY if) the entry is forced to the h:m:s format. Code: ? DateDiff("s", 0, CDate("0:4:30")) 270 Which might be accomplished via a mask for the textbox. MichaelRed Upvote 0 Downvote
then, of course, you could get the conversion in a single step - IF (and ONLY if) the entry is forced to the h:m:s format. Code: ? DateDiff("s", 0, CDate("0:4:30")) 270 Which might be accomplished via a mask for the textbox. MichaelRed