calculate seconds since midnight

Posted on 2000-02-17
Last Modified: 2008-03-17
how to calculate calculate seconds since midnight?
Question by:taimur
  • 2
LVL 12

Expert Comment

ID: 2533972
Use the Timer object. It returns a Single containing the seconds passed since midnight !!!

'Msgbox Timer'

Good luck !


Accepted Solution

paulstamp earned 10 total points
ID: 2533995
Use DateDiff function, setting the interval as "s"

MsgBox DateDiff("s", "00:00:00", Time)


Expert Comment

ID: 2533997
The above DateDiff is useful as it can be used to find seconds elapsed since any time or date, in intervals from years down to seconds.

Author Comment

ID: 2534279
Just what I needed.

Thank you paulstamp

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
VB6 add a minute to the date time value 8 61
MsgBox 2 47
Sending a email via excel using vba 6 71
SQL VB connection works in one PC and doesn't in another 15 55
The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

914 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now