Time Until Midnight

  • Thread starter shartman via AccessMonster.com
  • 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?
 
K

kingston via AccessMonster.com

[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.
 
S

shartman via AccessMonster.com

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?
 
J

John Vinson

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]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top