LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

number of seconds since midnight

Solved!
Go to solution

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?

 

 

 

0 Kudos
Message 1 of 28
(3,933 Views)

(Get Date/Time in Seconds) - (Date/Time to Seconds [for midnight today])

0 Kudos
Message 2 of 28
(3,922 Views)

A simple Quotient & Remainder will do the trick...


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 3 of 28
(3,890 Views)

@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.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 4 of 28
(3,871 Views)

@crossrulz wrote:

A simple Quotient & Remainder will do the trick...


That is brilliant! 

 

I would have done something like this:

Seconds.png

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 5 of 28
(3,867 Views)

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.

0 Kudos
Message 6 of 28
(3,854 Views)

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…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 7 of 28
(3,850 Views)

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.

???

0 Kudos
Message 8 of 28
(3,846 Views)

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!

 

 

0 Kudos
Message 9 of 28
(3,839 Views)

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.

0 Kudos
Message 10 of 28
(3,834 Views)