why access doesn't have hour format

  • Thread starter Thread starter khaled831
  • Start date Start date
K

khaled831

i've seen that MS Acess doesn't have hour format to calculate duration. it
has only particular time format. why MS is still not solving this? how can we
calculate total duration? MS Excel has this format. why not in MS Acess??
 
i've seen that MS Acess doesn't have hour format to calculate duration. it
has only particular time format. why MS is still not solving this? how can we
calculate total duration? MS Excel has this format. why not in MS Acess??

MS solving what? Instead of ranting about how Access isn't like Excel
(it's not supposed to be) and how Access can't do total duration
(whatever it is you mean by that, as Access calculates time intervals
quite nicely), why not let us help you by your being specific and
telling us exactly what it is you wish to do. Give us an example of
the data and the result you expect.
 
i'm a pilot and i've flown 994:00 hours. now i made a databse of my log book.
but the problem is I CAN'T WRITE 994:00 TO ANY RECORD.

now everyday i fly 3:00 approximately. but as Access doesn't recognise HOUR
it doesn't understand 3:00+994:00 = ?

isn't it a weakness of this program?

i'm a fan and big user of MS softwares. but, now i'm little fraustated. i'm
deprived of making use of Access in my need.

pl help me.
 
I wouldn't call it a weakness of the program, but perhaps a misunderstanding
on your part.

In Access, there is no Time data type. The only related data type, the Date
data type, is intended for timestamps (i.e.: specific Date/Times), not for
durations. That's because under the covers, the Date data type is 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.

To store durations in Access, decide what granularity you want (hours?
minutes? seconds?), and store the durations as long integers in those units.
In other words, if you want to keep track of minutes, store your 994 hours
as 59640 (994 * 60). Remember that DateDiff is only capable of returning
differences as long integers in the time unit you request, so if you've got
TimeStarted and TimeEnded variables, you can use DateDiff("n", TimeStarted,
TimeEnded) to give you the duration in minutes and add it to your existing
total.

If you want to be able to display the durations as something other than
minutes, write your own functions to convert to and from the formatted
display.
 
i've seen that MS Acess doesn't have hour format to calculate duration. it
has only particular time format. why MS is still not solving this? how can we
calculate total duration? MS Excel has this format. why not in MS Acess??

You're correct, Date/Time fields in Access aren't designed for storing
durations (they work best for storing specific points in time).

The usual solution (you can call it a "getaround" if that feels better) is to
store durations in a number field, storing the number of seconds, minutes, or
hours as appropriate. You can display (say) 9615 minutes as 400:15 using an
expression like

[Duration] \ 60 & ":" & Format([Duration] MOD 60, "00")
 
Back
Top