Time conversion and calculation

message from =?Utf-8?B?RXJpYyBTdGVwaGVucw==?= on 3 Jun 2004
30 (which equals 30 minutes)
100 (which equals 1 hour)
130 (which equals 1 hour 30 minutes)
etc.

I need to calculate the number of quarter-hours (15-minute intervals) within each of these values, and am at a loss on how to do this. I've contemplated dividing the field into two separate fields, but run into a problem extracting the hour digit since not every value has three digits (not to mention the result would be a text field that would prevent calculations). I am not familiar with VBA and how to create macros, so I'm pretty much limited to functions. Any help would be greatly appreciated!

Thanks,
Eric
 
Douglas J. Steele replied to =?Utf-8?B?RXJpYyBTdGVwaGVucw==?= on 3 Jun 2004
strValue = Format(intValue, "000")

Now, you can extract the first digit as hours, and the 2nd and 3rd digits as
minutes:

intHours = CInt(Left(strValue, 1))
intMinutes = CInt(Right(strValue, 2))

That last one could also be

intMinutes = CInt(Mid(strValue, 2))

Hopefully that's enough to get you going.
 

Archived message: Time conversion and calculation (MS Access Error Message)