Help with time calculations

  • Thread starter Thread starter Stacey Howard
  • Start date Start date
S

Stacey Howard

I would like to calculate the amount of minutes from midnight based on a
given time interval, like 3:30 PM. Can anyone assist please.


Stacey
 
This code will do it for you:

DateDiff("n",[Time],"00:00")

Where [Time] is a field in your database.

Toni
 
Sorry Stacey that previous code was the wrong way round
you need:

DateDiff("n","00:00",[Time])

Again [Time] represents a field in your database. If you
want to calculate it in relation to what time it is when
the code is run then use:

DateDiff("n","00:00",Now())

Toni

-----Original Message-----
This code will do it for you:

DateDiff("n",[Time],"00:00")

Where [Time] is a field in your database.

Toni
-----Original Message-----
I would like to calculate the amount of minutes from midnight based on a
given time interval, like 3:30 PM. Can anyone assist please.


Stacey


.
.
 
Take a look at the DateDiff function.

DateDiff("n",TimeValue(Date()),SomeTimeReference)
 
If your Field only contains the time component (i.e. date component is zero)
then you can use:

Int(YourDateTimeField * 1440)

For example, from Debug window:

?Int(#3:30# * 1440)
210

You can also use DateDiff() function. Check other reply or Access VB Help.
 
Back
Top