# LabVIEW

cancel
Showing results for
Did you mean:

## number of seconds since midnight

Solved!
Go to solution
Highlighted
Solution
Accepted by topic author psuedonym

## Re: number of seconds since midnight

@Mancho00 wrote:

I love crossrulz's solution, but have to adjust for current timezone.  Or just do this.

I think my solution is cleaner if you would rather calculate it and not worry abut time zones

-------------------------------------------------------------------
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)
Message 21 of 28
(276 Views)
Highlighted

## Re: number of seconds since midnight

@RTSLVU wrote:

My solution is cleaner if you would rather calculate it and not worry abut time zones

You forgot the Fractional Seconds.  Also, this is where the Compound Arithmetic node can help (expand to 4 inputs in the Add mode).

EDIT: Oh, and this will probably still break on the days DST is started and ended.  I would have to figure out what day that is in order to give it a try...But I am past time to go home.

There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
Message 22 of 28
(270 Views)
Highlighted

## Re: number of seconds since midnight

I learned a lot. Had not used LabVIEW's timestamp very much in the past.

Thanks again.

Message 23 of 28
(262 Views)
Highlighted

## Re: number of seconds since midnight

@crossrulz wrote:

@RTSLVU wrote:

My solution is cleaner if you would rather calculate it and not worry abut time zones

You forgot the Fractional Seconds.  Also, this is where the Compound Arithmetic node can help (expand to 4 inputs in the Add mode).

EDIT: Oh, and this will probably still break on the days DST is started and ended.  I would have to figure out what day that is in order to give it a try...But I am past time to go home.

Actually I had the fractional seconds in there to begin with but took it out as I don't think the VB function the OP was trying to duplicate returns fractional seconds.

Interesting thought about DST start and end days...

But that is what UTC is for after all 😛

-------------------------------------------------------------------
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)
Message 24 of 28
(259 Views)
Highlighted

## Re: number of seconds since midnight

Also I am going to toss this out there just in case you notice there is a difference between LabVIEW and VB.NET raw timestamps...

The OLE (Windows, Excel, etc) date format is a double-precision floating point number that counts the time from 30 December 1899 00:00:00.

(Epoch 0 December 1899 00:00:00)

The UTC date that is returned from the LabVIEW functions is the number of seconds elapsed since 12:00 a.m., Friday, January 1, 1904.

(Epoch 12:00 a.m., Friday, January 1, 1904)

-------------------------------------------------------------------
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)
Message 25 of 28
(255 Views)
Highlighted

## Re: number of seconds since midnight

@RTSLVU wrote:

Interesting thought about DST start and end days...

But that is what UTC is for after all 😛

Indeed.  And one of the reasons I use UTC as the time zone on all of my test systems.

"Sea" story:

I inherited a system that was doing thermal cycles and it used the system time for calculating the soak times.  DST kicked in during said soak time.  Confusion insued when the thermal charts showed an extra hour of soaking.  It took them several days before realizing DST was the cause.  Their fix was to not test on the weekends DST transitioned.

There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
Message 26 of 28
(214 Views)
Highlighted

## Re: number of seconds since midnight

For the purpose of number of seconds since midnight I do not think there will be issues an the LV logic will handle that without an issues.

The complication with DST is when we try to turn the seconds since 1904 into a time like 2:00 AM.

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 27 of 28
(197 Views)
Highlighted

## Re: number of seconds since midnight

@crossrulz wrote:

"Sea" story:

I inherited a system that was doing thermal cycles and it used the system time for calculating the soak times.  DST kicked in during said soak time.  Confusion insued when the thermal charts showed an extra hour of soaking.  It took them several days before realizing DST was the cause.  Their fix was to not test on the weekends DST transitioned.

OMG! That's funny...

Patient: Doctor, it hurts when I do this.

Doctor: Then don't do that.

-------------------------------------------------------------------
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)
Message 28 of 28
(181 Views)