none
Converting from hours(and minutes) to minutes only RRS feed

  • Question

  • i've been able to format from time intervals to hours(i.e. "80 To 1:20") but how do I do it backwards, like from hours to time intervals/minutes (i.e."1:20 To 80)?
    • Edited by C.O. NoiZe Friday, July 1, 2016 5:02 AM
    Friday, July 1, 2016 5:01 AM

Answers

  • Let's say you have a date/time field Duration. In a query, you can use

    Minutes: 1440*[Duration]

    or in the Control Source of a text box on a form or report:

    =1440*[Duration]


    Regards, Hans Vogelaar (http://www.eileenslounge.com)

    Friday, July 1, 2016 9:25 AM
  • Is the duration a string expression?  If so, provided that the value will always be less than 24 hours you can do so by converting it to a date/time value and then returning the difference in minutes between zero and the value, e.g. in the debug window:

    Duration = "1:20"
    ? DateDiff("n",0,Cdate(Duration))
     80

    If, on the other hand, the duration can be 24 hours or more, you'd have to parse the value, e.g.

    Duration = "24:20"
    ? (Left(Duration,Instr(Duration,":")-1)*60)+Mid(Duration,Instr(Duration,":")+1)
     1460

    Ken Sheridan, Stafford, England

    Saturday, July 2, 2016 11:36 AM

All replies