• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 422
  • Last Modified:

Convert 0,90 into 1 hour 30 min in MS ACCESS

Hi, I need to convert 0,90 into 1 hour 30 min or
1,90 to 2 hour 30 min.
1 Solution
With VBA:

Sub CallStringToTime()
    Dim strTimeString As String
    strTimeString = "1,90"
    MsgBox StringToTime(strTimeString)
End Sub

Function StringToTime(strTimeString As String) As Date
    Dim strTimeParts() As String
    strTimeParts = Split(strTimeString, ",")
    StringToTime = TimeSerial(strTimeParts(0), strTimeParts(1), 0)
End Function

Open in new window

Gustav BrockCIOCommented:
If your values are decimals, a one-liner will do:

datHours = TimeSerial(Int(t), (t - Int(t)) * 100, 0)

ConvTime: Format(TimeSerial(Val([tm]), Mid([tm], InStr([tm], ",") + 1), 0), "h \hr mm \m\i\n")

The above will convert 1,90 to give you 2 hr 30 min
Easily Design & Build Your Next Website

Squarespace’s all-in-one platform gives you everything you need to express yourself creatively online, whether it is with a domain, website, or online store. Get started with your free trial today, and when ready, take 10% off your first purchase with offer code 'EXPERTS'.

Gustav BrockCIOCommented:
I still believe 0,90 and 1,90 represent decimal numbers, thus should be treated as so.


Yes, that's interesting. But if the asker has continental settings so that 1,90 is the same as decimal 1.9 hours, then it would convert to 1 hour and 54 minutes, which is not what the asker expects.
Martin LissOlder than dirtCommented:
This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now