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: 

Wanting to add a timestamp to column 1 in Excel, feel like there's a better way.

Solved!
Go to solution

I am wanting to add a timestamp to column 1 in Excel, feel like there's a better way than in the attached VI. 

Currently, I have the date coming back in seconds, I've tried it as a string but can't get it to work properly, I think it's just something about how I build the array that I'm forgetting. 

LV2013 is the highest available to me.

0 Kudos
Message 1 of 7
(929 Views)
Search for "Time to XL.vi" you can even just look at my profile page in the most kudos posts section for add timing functions.

Excel cannot use strings for graphing or calculations so, it is often better to send a floating point value that Excel can use as a timestamp.

"Should be" isn't "Is" -Jay
Message 2 of 7
(904 Views)

@JÞB wrote:
Search for "Time to XL.vi" you can even just look at my profile page in the most kudos posts section for add timing functions.

Excel cannot use strings for graphing or calculations so, it is often better to send a floating point value that Excel can use as a timestamp.

I've dropped it in where the time stamp to DBL was, but it doesn't seem to actually produce a time stamp. It produces the same number repeatedly, and not in a time format? 

0 Kudos
Message 3 of 7
(887 Views)

@LVIEWPQ wrote:

@JÞB wrote:
Search for "Time to XL.vi" you can even just look at my profile page in the most kudos posts section for add timing functions.

Excel cannot use strings for graphing or calculations so, it is often better to send a floating point value that Excel can use as a timestamp.

I've dropped it in where the time stamp to DBL was, but it doesn't seem to actually produce a time stamp. It produces the same number repeatedly, and not in a time format? 


JB_0-1680101640807.png

If you read the documentation, you will find that the XL Time output is in fact only a float but, if you change the display format of that value IN EXCEL to display the cell as absolute time e.g. yyyy/mm/dd hh:mm:ss.uuu  Excel will show the correct date for YOUR machine's local timezone.  NOTE: the timestamp constant is US Central time.  It may need to be adjusted for your local machine since Timestamps are always stored internally as UTC.


"Should be" isn't "Is" -Jay
Message 4 of 7
(849 Views)

@JÞB wrote:

@LVIEWPQ wrote:

@JÞB wrote:
Search for "Time to XL.vi" you can even just look at my profile page in the most kudos posts section for add timing functions.

Excel cannot use strings for graphing or calculations so, it is often better to send a floating point value that Excel can use as a timestamp.

I've dropped it in where the time stamp to DBL was, but it doesn't seem to actually produce a time stamp. It produces the same number repeatedly, and not in a time format? 


JB_0-1680101640807.png

If you read the documentation, you will find that the XL Time output is in fact only a float but, if you change the display format of that value IN EXCEL to display the cell as absolute time e.g. yyyy/mm/dd hh:mm:ss.uuu  Excel will show the correct date for YOUR machine's local timezone.  NOTE: the timestamp constant is US Central time.  It may need to be adjusted for your local machine since Timestamps are always stored internally as UTC.


OK but that doesn't change the fact that the output is still an identical float in every cell

0 Kudos
Message 5 of 7
(842 Views)
Solution
Accepted by topic author LVIEWPQ

@LVIEWPQ wrote:

@JÞB wrote:

@LVIEWPQ wrote:

@JÞB wrote:
Search for "Time to XL.vi" you can even just look at my profile page in the most kudos posts section for add timing functions.

Excel cannot use strings for graphing or calculations so, it is often better to send a floating point value that Excel can use as a timestamp.

I've dropped it in where the time stamp to DBL was, but it doesn't seem to actually produce a time stamp. It produces the same number repeatedly, and not in a time format? 


JB_0-1680101640807.png

If you read the documentation, you will find that the XL Time output is in fact only a float but, if you change the display format of that value IN EXCEL to display the cell as absolute time e.g. yyyy/mm/dd hh:mm:ss.uuu  Excel will show the correct date for YOUR machine's local timezone.  NOTE: the timestamp constant is US Central time.  It may need to be adjusted for your local machine since Timestamps are always stored internally as UTC.


OK but that doesn't change the fact that the output is still an identical float in every cell


Well, lets do some math.  Excel increments time by 1 every day and there are 1000 mSec / Sec  60 Sec / Minute, 60 Minutes per hour and 24 Hours per day.  So: each call to your timestamp after converting it through Time to Excel.vi will ideally be the same as the last time plus the irrational value 1.157407e-9 with 407 repeating.  The default format for Write to Spreadsheet File.vi is %.3f which is three digits of  precision so, to change the third digit of precision you would need 864000 readings or 864 seconds of acquisition.  %.15f would be appropriate as a DBL has about 15 digits of precision and today is the 45012th day after Excel epoch.


"Should be" isn't "Is" -Jay
Message 6 of 7
(828 Views)

Thanks, it was the understanding of the output letting me down. 

0 Kudos
Message 7 of 7
(797 Views)