From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

time stamp to number function

Solved!
Go to solution
The Conversion VIs and Functions palette has a function that converts the number of seconds elapsed to a time stamp (To Time Stamp Function).  I need to go in the other direction, from a time stamp to a double (number of seconds elapsed since 12:00 a.m., Friday, January 1, 1904 Universal Time).  Does anyone have a function to do this?  I've tried to type cast with no success.
Steve Hall
stephen.hall@parker.com
0 Kudos
Message 1 of 11
(49,848 Views)
Solution
Accepted by topic author parker_irvine
Just use the To Double Precision Float function. It's polymorphic and it will accept a timestamp to return the number of seconds since the LabVIEW "zero-time".
Message 2 of 11
(49,848 Views)

That is really helpful. Now,  how do I convert the numeric back to a timestamp?

0 Kudos
Message 3 of 11
(37,066 Views)

OK, I'll answer my own question.  There is a VI called 'To Timestamp' in the time pallet which does the job beautifully. 

0 Kudos
Message 4 of 11
(37,062 Views)

Hi,

 

I need your help. I want to collect timestamp in format of  03/24/2016 07:20:01  for each of data. I did coding in a way as timestamp file. But my output data is different format. It shows fraction in second value. I changed it several ways and it did not work. Can you please help me?

Download All
0 Kudos
Message 5 of 11
(34,324 Views)

Why don't you post your vi instead of two pictures that have absolutely no relation to each other?

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 6 of 11
(34,311 Views)

What format are you saving the file in?  Could you give us a VI so we can see your settings for the Write Measurement File?


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 7 of 11
(34,282 Views)

You do know that you can right click on the top of a column in Excel and select "Format Cells" and chage the time/date format in your spreadsheet, right?

 

Personally I just dump the "raw number" into excel and format it like I said above because I may or may not want the date included.

 

I use this little VI to add a time stamp to data as I save it.

 

Timwriter.png

 

As I said the raw time stamp will look like this in Excel

et1.PNG

With a couple clicks of the mouse in Excel it can look any way you want.

et2.PNG  et3.PNG

 

 

========================
=== Engineer Ambiguously ===
========================
Message 8 of 11
(34,259 Views)

Thanks.

 

But I guess, I have another problem. I need to collect data for every second and write to file. But how can I control the time in write to measurement file?

 

When I collect data as the attached file it gives the data in every 0.833second. But I need to collect for each second. My question is how to write measurement file every second?

 

 

Download All
0 Kudos
Message 9 of 11
(34,210 Views)

You need a timer in your loop so it only reads the frequency and saves it once per second

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 10 of 11
(34,143 Views)