Time calculations

Matt Brown

Registered User.
Local time
Today, 00:21
Joined
Jun 5, 2000
Messages
120
Hi,

Is it possible to do the following in a query.

I have one field which when a record is created stamps the time in the following format

##:##:## The field is called [TimeStamp]

I have a user combo box which has a list of the following values:

00:05:00
00:10:00
00:15:00
00:30:00

etc etc
The field for this is called [UserTime]

Is it possible to do the following in a query:

Time:[TimeStamp]-[UserTime]

Do i need to do some data conversions first?

Any help would be appreciated.

Thanks

Matt
 
Time: CDate([TimeStamp])-CDate([UserTime])
 
Hi

Just tried your suggestion and get the following output:

0.515266203703704

For a TimeStamp of 13:21:59 and a selected value 0f 00:01:00

Just read up on the CDate function, does this only apply to dates rather than time, or is this a silly question?

Matt
 
Last edited:
Time is included within a date.

0.515266203703704 will also be right.

Dates are held as Longs, really. The portion to the left of the decimal point is the date and the decimal part is the time. Therefore from that you have the time.
 
Incidentally, that number is 12:21:59 once you format it.
 

Users who are viewing this thread

Back
Top Bottom