[Solved] VBA: Convert decimal into time

  • I have a field where it has a decimal number representing time eg. 0.5 same as 50 minutes. Does anyone know how I can convert this decimal into a time format eg 0:50?


    Thanks in advance

  • Excel tracks time as a fraction of a day. So if 0.5 represents 50 minutes it is 50/60 (or 0.5/0.6) of an hour and (0.5/0.6)/24 of a day. Make this calulation and you should then be able to format the result (e.g., hh:mm:ss or whatever works best for you) as time.


    Working with time formats can be tricky. Dave has some great help/hints posted on this website ... I think they are found via the Excel Dates adn Times link at.


    http://www.ozgrid.com/Excel/ExcelDateandTimes.htm

  • "Working with dates is a real hassle..."



    Shouldn't be, as long as you keep one thing in mind:


    If you don't enter a genuine date value to represent a date, your life will become hell later.


    For example, if 09/06/2003 is a Monday & you want to display the date as Monday, just enter the full date & apply the appropriate format (ddd in this case). having entered a date value, you can still do all the standard calculations - enter Mon as text & about all you can know is that it's a text string of lenght 3.


    Always enter a full date value


    paddy

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!