LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Hour portion is not coming properly in CSV file

Hi Guys, 

 

I have a 2D array with Number, date, and two different columns with time (hr:mm:sec). The CSV file is showing the header and the data but the hour portion is not coming to the file. 

 

1.JPG

Hk637_0-1714077601718.png

 

Can anyone suggest me the solution?

 

0 Kudos
Message 1 of 6
(147 Views)

What you see on Excel is not what exactly is stored in CSV, Excel attempts to figure out the data in the column and applies formatting. Due to that you may think the data is not stored in the CSV but the reality is the Excel is not showing the data properly.

 

The right way to verify content of CSV is to open it in a text editor like Notepad++ which does not change the display format.

Santhosh
Soliton Technologies

New to the forum? Please read community guidelines and how to ask smart questions

Only two ways to appreciate someone who spent their free time to reply/answer your question - give them Kudos or mark their reply as the answer/solution.

Finding it hard to source NI hardware? Try NI Trading Post
0 Kudos
Message 2 of 6
(103 Views)

The first proper hr:mm:sec is from Labview array actually which is passed to write delimated file function of Labview to write CSV file. 

0 Kudos
Message 3 of 6
(87 Views)

Commonly used separator for csv is usually ";", then Excel will open files properly:

time1.png

Note that 26-Apr-24 converted to 26. Apr 24, because I have German localization.

If you would like to avoid this, just add space before:

time2.png

and if you would like to avoid this warning

Screenshot 2024-04-26 063617.png

then obviously use year, including the century:

time3.png

Hope it helps.

Please next time attach VI and not jpeg screenshot.

0 Kudos
Message 4 of 6
(80 Views)

Thanks a lot. Actually, my problem was the time stamp (03:24.43.00) was coming as (24.43.00) leaving the hour (03:).

0 Kudos
Message 5 of 6
(70 Views)

@Hk637 wrote:

Thanks a lot. Actually, my problem was the time stamp (03:24.43.00) was coming as (24.43.00) leaving the hour (03:).


In my example, the timestamp appears correctly in Excel.Unfortunately, it's hard to reproduce on my side because the comma "," is the decimal separator on my OS. In your case, it could be different. This is a reason why I recommend using the semicolon ";" as the separator instead, as this should solve the problem on your side as well. Just try it. Or do you have a specific reason to use the "," separator?

0 Kudos
Message 6 of 6
(63 Views)