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
(483 Views)

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

0 Kudos
Message 2 of 28
(472 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
Message 3 of 28
(440 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
(421 Views)

@crossrulz wrote:

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


That is brilliant! 

 

I would have done something like this:

Seconds.png

-------------------------------------------------------------------
Unfortunately, most readers of this Forum, including some real Experts, have not mastered the skill of being able to read the code that Posters fail to post. If we cannot see "what you did wrong", we are unable to tell you how to fix it. (Bob Schor 28 August 2018)
0 Kudos
Message 5 of 28
(417 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
(404 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
CLAD expired, using LV2011SP1 + LV2017 (+LV2019 sometimes) on Win7+cRIO
Kudos are welcome Smiley Wink

0 Kudos
Message 7 of 28
(400 Views)
Highlighted

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
(396 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
(389 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
(384 Views)