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
(8,560 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
(blog)
Message 2 of 9
(8,540 Views)
Solution
Accepted by 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. 

========================
=== Engineer Ambiguously ===
========================
Message 3 of 9
(8,513 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
(8,500 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.


"Should be" isn't "Is" -Jay
0 Kudos
Message 5 of 9
(8,404 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.

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 6 of 9
(8,399 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


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

thank you 

0 Kudos
Message 8 of 9
(7,785 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
(7,766 Views)