Time variables, exact value

S

Stuart

I have a key in my database that is a time value. Duplicates are not
allowed. However, I am getting them. When I look at the values, they
appear identical, yet the "duplicates catcher" doesn't catch them. I suspect
a rounding problem, as I am computing time (sometimes). In other words,
3:20pm entered into a field may not be exactly the same as 3:20pm computed by
adding 20 minutes to 3:00pm.

Is there any way to round times, or to examine exactly what they are so I
can debug this problem?

Thanks, Stuart
 
J

John Vinson

Is there any way to round times, or to examine exactly what they are so I
can debug this problem?

Date/Time values are stored as Double Float numbers, a count of days
and fractions of a day (times) since midnight, December 30, 1899. As
such they are *stored* accurate to a few microseconds - even finer if
it's just a time with no date portion; however, it can only be
displayed or searched accurate to one second.

You can round times to the nearest minute using

Format([timefield], "hh:nn")

or to the second using hh:nn:ss. I'm not *certain* that this will get
rid of all the duplicates but it ought to.

John W. Vinson[MVP]
 
S

Stuart

It worked! Thanks.

John Vinson said:
Is there any way to round times, or to examine exactly what they are so I
can debug this problem?

Date/Time values are stored as Double Float numbers, a count of days
and fractions of a day (times) since midnight, December 30, 1899. As
such they are *stored* accurate to a few microseconds - even finer if
it's just a time with no date portion; however, it can only be
displayed or searched accurate to one second.

You can round times to the nearest minute using

Format([timefield], "hh:nn")

or to the second using hh:nn:ss. I'm not *certain* that this will get
rid of all the duplicates but it ought to.

John W. Vinson[MVP]
 
Top