Time Until Midnight

  • Thread starter Thread starter shartman via AccessMonster.com
  • Start date Start date
S

shartman via AccessMonster.com

I need to be able to calculate the time to midnight on any given day. E.g. it
is 4:00 pm. How many hours, minutes and seconds until midnight? I've tried
several different approaches with inconsistent results. Any help?
 
[TimeToMidnight] = formatdatetime(#11:59:00 PM# - Time() + #00:01:00#,
vbShortTime)
This won't return seconds, but you can play with the functions to get the
output you want.
 
That's It. Works like a charm....

Thank You!
[TimeToMidnight] = formatdatetime(#11:59:00 PM# - Time() + #00:01:00#,
vbShortTime)
This won't return seconds, but you can play with the functions to get the
output you want.
I need to be able to calculate the time to midnight on any given day. E.g. it
is 4:00 pm. How many hours, minutes and seconds until midnight? I've tried
several different approaches with inconsistent results. Any help?
 
I need to be able to calculate the time to midnight on any given day. E.g. it
is 4:00 pm. How many hours, minutes and seconds until midnight? I've tried
several different approaches with inconsistent results. Any help?

Just an alternative:

CDate(1.0 - CDbl(Time()))


John W. Vinson[MVP]
 
Back
Top