10-10-2019 11:32 AM
I am trying to duplicate VB.NET's Microsoft.VisualBasic.DateAndTime.Timer which returns the number of seconds elapsed since midnight.
LabVIEW's timestamp gives number of seconds since midnight of 01/01/1904.
How do I go about getting the number of seconds since midnight of the current day?
Solved! Go to Solution.
10-10-2019 11:41 AM - edited 10-10-2019 11:42 AM
(Get Date/Time in Seconds) - (Date/Time to Seconds [for midnight today])
10-10-2019 12:30 PM - edited 10-10-2019 12:30 PM
A simple Quotient & Remainder will do the trick...
10-10-2019 01:13 PM
@crossrulz wrote:
A simple Quotient & Remainder will do the trick...
I would've never thought of that. I would have tried to do it literally, but you what you did was find the number of days since LabVIEW epoch time - and because days were expressed in seconds, the remainder will be in seconds - which, of course, is "today" in seconds.
Nice.
10-10-2019 01:23 PM
@crossrulz wrote:
A simple Quotient & Remainder will do the trick...
That is brilliant!
I would have done something like this:
10-10-2019 01:50 PM
Don't I need to input the current midnight using this method?
Unless I am not understanding this.
I want to use the current timestamp to figure out the seconds automatically.
10-10-2019 01:54 PM - edited 10-10-2019 01:55 PM
Hi psuedonym,
@psuedonym wrote:
I want to use the current timestamp to figure out the seconds automatically.
Which of the shown solutions doesn't give the expected output?
They all use the current timestamp - or can use it…
10-10-2019 01:57 PM
Sorry.
I mean the solution by crossrulz.
I am not understanding how that solution works because it looks like I have to manually enter today's midnight.
???
10-10-2019 02:02 PM
Try programming his solution and try to prove how it would not work. If you think you have to manually enter something, then you should be able to offer proof why you would need to.
You don't because the epoch starts at midnight. Every 86400 seconds, a new day starts. So any seconds in excess of a multiple of 86,400 (thus remainder of quotient/remainder) would be the number of seconds since the most recent midnight!
10-10-2019 02:06 PM - edited 10-10-2019 02:10 PM
I am trying.
I can't download his snippet and I am using LV 2014.
I cannot find the control that he is using.
Edit: he had his Timestamp as View as Icon.
When I run it, I get 68535.3 seconds .
It is about 3:09 pm
Manually, I calculate it to be 54000+ seconds.