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: 

logging day:hour:min:second into a write to spreadsheet file

Solved!
Go to solution

I need to write a date time stamp in format of day:hour:min:second (25:13:23:56) to a spreadsheet file.   Ideally using the output from "Format Date/Time String" and going into a "Build Array" from there it goes into write to spreadsheet.  The only reason this is the format necessary is because I have a program data logging 10 scientific meters already up and running.  It uses the date stamp from a Datetime.vi that is in integer form 132356.

 

Thanks in advance for your help

NAS1
St Petersburg FL
Labview 2010
0 Kudos
Message 1 of 16
(4,198 Views)

It seemed as though you were very close to the solution.

Review the attached modified VI and see what you think.

Take notice of some of the changes I made.

CLD | CTD
LabVIEW 2011 SP1 | TestStand 4.5
Message 2 of 16
(4,196 Views)

I should have told everyone I'm still stuck in Labview 7.1  Unfortunatley that means I get an error when trying to open your solution.  Any thoughts?

NAS1
St Petersburg FL
Labview 2010
0 Kudos
Message 3 of 16
(4,191 Views)

Hi nas1,

 

CCornish' solution will not work for you as WriteToSpreadsheet is limited to SGL data in LV7.1. (Sidenote: put you LV version info in your signature, so you can't forget to mention it...)

 

You don't say how to format that timestring exactly. Should it be put in a "cell" togetherwith more data in the same row or should it be just one line?

In the latter case you could use "WriteCharactersToTextfile" instead in appending mode... Otherwise there's the "array to spreadsheet string" function to make your own conversion routine. Look into theWriteToSpreadsheat as an example!

Message Edited by GerdW on 06-25-2009 10:46 PM
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 4 of 16
(4,184 Views)

nas1,

 

Time to XL.PNG

This is a shot of the code I use to convert to spreadsheet time format.  Excel can display this number by formatting the cell as time in any format.  It gives you the added benefit that calculations can be done in Excel (such as, get elapsed time, or ,create a graph vs. time,) You can't do that from text.  Lotus uses the same epoch (start date) and scale as Excel but, I haven't used it so I don't know if the calculations work there.  They should. 


"Should be" isn't "Is" -Jay
Message 5 of 16
(4,178 Views)
GerdW, I'm currently trying to upgrade 7.1 to 8.5.1.  I'll finish in the morning hopefully.  Then CCornish solution should work.  But in the meantime, I wanted the time string 25:13:23:56 to be fed into one line of about a twenty section array (made using the build array func)  that then goes to a write to spreadsheet vi.  I'm certainly not a proven labview veteran so if I'm using the wrong terminology or missing your point just let me know.  I can attach the whole larger vi if it would help.  on a side note I'll fix the signature when I decide if 8.5 is working thanks for the suggestion
NAS1
St Petersburg FL
Labview 2010
0 Kudos
Message 6 of 16
(4,173 Views)

Jeff, we are not using either excell or Lotus because our data sets are too large.  They exceed the max number of lines, so we are using Kaliedagraph.  But anyway, they the data processors, want the time stamp to have the day of the month before the time. ie  day:hour:min:sec  this usually precludes you from using built in time functions of many softwares.  

NAS1
St Petersburg FL
Labview 2010
0 Kudos
Message 7 of 16
(4,169 Views)

Hi nas1,

 

then you may use "insert into array".

("Sections" probably means elements of a 1D array. And you didn't note the datatype of your array... )

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 8 of 16
(4,163 Views)
just format in the spreadsheet for excel the format code is d:h:mm:ss.sss

"Should be" isn't "Is" -Jay
Message 9 of 16
(4,162 Views)

Alright folks,  Thanks for your help so far, I've decided to include the larger vi so you can better understand what I'm trying to do.  At the top of the array, I have two blue (numeric) leads carrying date and time information.  I need the date to be left alone and the time to be in the form of Day:Hour:Minute:Second, the only way that I have been able to get the time into this form leaves me with a pink (string) lead.  The array won't allow this as an input.  Below is my current data string output (3 lines) and below that is what I want (3 lines although with out the linewrap issues thats a forum thing) the red is all I've changed.

 


712008 115047 8.47 24.1 6.92 24.1 6.76 74.8 6.74 74.9 -0.003 24.48 0 -0.045 24.467 0 0.201 0.201 27.2 0.005 0.005 27.8 1.652 1.785 0.855
712008 115051 8.47 24.1 6.93 24.1 6.76 74.8 6.74 74.9 -0.003 24.479 0 -0.045 24.467 0 0.199 0.199 27.2 0.003 0.003 27.8 1.647 1.786 0.851
712008 115055 8.47 24.1 6.93 24.1 6.76 74.8 6.74 74.9 -0.003 24.479 0 -0.045 24.467 0 0.197 0.197 27.2 0.005 0.005 27.8 1.578 1.693 0.812

712008 12:11:50:47 8.47 24.1 6.92 24.1 6.76 74.8 6.74 74.9 -0.003 24.48 0 -                                                                                                                        0.045 24.467 0 0.201 0.201 27.2 0.005 0.005 27.8 1.652 1.785 0.855
712008 12:11:50:51 8.47 24.1 6.93 24.1 6.76 74.8 6.74 74.9 -0.003 24.479 0 -                                                                                                                      0.045 24.467 0 0.199 0.199 27.2 0.003 0.003 27.8 1.647 1.786 0.851
712008 12:11:50:55 8.47 24.1 6.93 24.1 6.76 74.8 6.74 74.9 -0.003 24.479 0 -                                                                                                                        0.045 24.467 0 0.197 0.197 27.2 0.005 0.005 27.8 1.578 1.693 0.812

 

Thanks in advance

 

Nathan Smiley

Labview 7.1 and 8.5

NAS1
St Petersburg FL
Labview 2010
0 Kudos
Message 10 of 16
(4,105 Views)