LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to change labview timestamp epoch to UTC epoch

Solved!
Go to solution

hi,

      i have database table in UTC epoch field.i want to select  and insert data from database table based on labview timestamp controll.

 

    example:

                       table:

                                   S:no      U.name         PWD                Epoch(UTC 1970)

 

                                    1           kumar            123                 1450422341

                                    2           sham              786                 1450421623

 

the labview epoch is difference from UTC epoch. so ADD this  second 2082844800 to  labview epoch than it will work for selection quary but insert epoch is not work.

 

 

0 Kudos
Message 1 of 9
(3,860 Views)

UTC is essentially just a timezone - it doesn't have an 'epoch' (well... year 0 in gregorian calendar). Unless you mean the Unix epoch?

 

The LabVIEW timestamp starts at 01/01/1904 00:00:00.00 UTC

The unix epoch is 01/01/1970 00:00:00.00 UTC

 

(Note how both times are expressed in UTC!)

 

 

If you use the 'timestamp to number' VI, it will convert the LabVIEW timestamp into the number of seconds since the LabVIEW start time. You can then add the 66 years worth of seconds to it to convert it to the Unix epoch.


LabVIEW Champion, CLA, CLED, CTD
MediaMongrels Ltd. - NI Alliance Partner (blog)
Message 2 of 9
(3,840 Views)
Solution
Accepted by topic author GokulGKM

Here is how I convert a LabVIEW time stamp to an Excel (OLE) timestamp.

 

Timeconvert.png

Red the explainiation at the bottom and I am sure you can figure out how to change it to get use Epoch you need. 

-------------------------------------------------------------------
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 3 of 9
(3,813 Views)

An example of converting a LabVIEW timestamp to a *NIX # seconds since Jan 1,1970  can be found here (even with LV 8.2 download!)

 

https://decibel.ni.com/content/docs/DOC-3644

 

 I would avoid using the kernel32.dll example and try creating the example I provided at the bottom. I used LabVIEW 2011 for the example, don't have 8.2 installed.


Now is the right time to use %^<%Y-%m-%dT%H:%M:%S%3uZ>T
If you don't hate time zones, you're not a real programmer.

"You are what you don't automate"
Inplaceness is synonymous with insidiousness

0 Kudos
Message 4 of 9
(3,800 Views)

Well, Time 2 Excel rides again! Capture.PNG

 

The Only problem with that vi.... DAMNED timestamp constants!  Whitch is exactly what I feel you are hitting..... Timestamp constants do not travel well! they are tied to the system time settings.  Don't get me wrong! that little vi has over a dozen solved threads on these forums!  Its just that you need to pick a timezone for all of the target machines.  Set them ALL up for UTC! Then, everybody plays along nice.

Scientists STAND on the shoulders of giants! They don't ride "piggyback" to keep their heads down.

"Should be" isn't "Is" -Jay
0 Kudos
Message 5 of 9
(3,704 Views)

@JÞB wrote:

Well, Time 2 Excel rides again

 

The Only problem with that vi.... DAMNED timestamp constants!  Whitch is exactly what I feel you are hitting..... Timestamp constants do not travel well! they are tied to the system time settings.  Don't get me wrong! that little vi has over a dozen solved threads on these forums!  Its just that you need to pick a timezone for all of the target machines.  Set them ALL up for UTC! Then, everybody plays along nice.


While you make some valid points, try explaining to my manager why the timestamps are all eight or nine hours off.

-------------------------------------------------------------------
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 6 of 9
(3,699 Views)

@RTSLVU wrote:

@JÞB wrote:

Well, Time 2 Excel rides again

 

The Only problem with that vi.... DAMNED timestamp constants!  Whitch is exactly what I feel you are hitting..... Timestamp constants do not travel well! they are tied to the system time settings.  Don't get me wrong! that little vi has over a dozen solved threads on these forums!  Its just that you need to pick a timezone for all of the target machines.  Set them ALL up for UTC! Then, everybody plays along nice.


While you make some valid points, try explaining to my manager why the timestamps are all eight or nine hours off.


Windows

Scientists STAND on the shoulders of giants! They don't ride "piggyback" to keep their heads down.

"Should be" isn't "Is" -Jay
0 Kudos
Message 7 of 9
(3,690 Views)

thank you 

0 Kudos
Message 8 of 9
(3,085 Views)

Paul Cardinale posted this nifty tidbit that calculates UTC offset a while back.utc offset.png

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 9 of 9
(3,066 Views)