Convert Integer to System Time format

L

Longworth2

Hi
I need to convert minutes (Integers) to the System Time Format (i.e.
Double)
For example, 8 minutes should be converted to something that Access
recognizes as a Date/Time number representing 8 minutes.
Thanks for any help.
 
D

Douglas J. Steele

Realistically, you shouldn't. In VBA, the Date data type is intended for
timestamps: exactly points in time. That's because under the covers, the
data is stored as an eight-byte floating point number, where the integer
portion represents the date as the number of days relative to 30 Dec, 1899,
and the decimal portion represents the time as a fraction of a day. That
means that durations (such as 8 minutes) aren't really supported.

However, if you're determined, note where I said that "the decimal portion
represents the time as a fraction of a day". Since there are 1440 minutes in
a day, you could use 8/1440. If you format that value as a time, you'll see:

?Format(8/1440, "hh:nn:ss")
00:08:00
 
D

Duane Hookom

A day equals the number 1. There are 24 hours in a day so an hour is 1/24th
or 0.041666666666666666666666666666667. You should be able to figure out from
this, how to take 8 minutes and display it as 0:08:00.
 
J

John Spencer

One method is to use the dateadd function.

DateAdd("n",SomeValue,0)


Warning if you add more than 1439 minutes you are going to get the time
moved ahead by one day. So 1441 would give you one minute past midnight
on Dec 31, 1899.


'====================================================
John Spencer
Access MVP 2002-2005, 2007-2009
The Hilltop Institute
University of Maryland Baltimore County
'====================================================
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top