LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

problem reading file with excel : adds a month instead of a day

Hello,

I would like to write in a file, the date and the time, every second for example . I have made up the VI ( see attached file ) and it works fine if I open it with note pad for example. However I have problems when I open it ( this same file )with excel : when the time changes from 23:59:59 to 00:00:00, excel adds a month to the date instead adding a day ! And I don't know how to solve this problem...

Any help would be really great,

Thanks a lot,

David
0 Kudos
Message 1 of 5
(2,630 Views)
Hello David,

Your problem must have something to do with date formattings in your PC - like dd-mm-yy instead of mm-dd-yy...
Excel is not adding a month, the file is there and it was written by LabVIEW, Excel is just interpreting the values in the cells.
Try formmating the cells where the date is in excel -> Format -- Cells -You have there a lot of formatting options.

Hope this helps,
Paulo
Message 2 of 5
(2,625 Views)
Your problem can arise from the format of the date. The format of the "Get Date / Time String" function depends on the regional settings of the machine. Excel also uses this setting. If you write the file on a machine where the setting is MM/DD/YYYY and read it on a machine set to DD/MM/YYYY the month seems to be incremented but the day not, e. g. 06/01/2005 (1 June 2005) followed by 06/02/2005 will give 6 January 2005 followed by 6 February 2005.

To avoid this use the "Format Date / Time String" function and format it either according to ISO-8601 or the setting of the machine where the file will be read.
Waldemar

Using 7.1.1, 8.5.1, 8.6.1, 2009 on XP and RT
Don't forget to give Kudos to good answers and/or questions
Message 3 of 5
(2,622 Views)
Hello PauloM,

Thanks for ur help, my program is now working fine. However I still have a problem with the date in excel. I am writing in the same column the date and the time whith the string : "d/mm/yyyy hh:mm:ss". The problem is that it writes ok the date and the time ( changing day works fine too ) but it sets a space before the first "d". So if I want to plot my results according to the time I have to take that space away and then it is ok.
Would u have any ideas how I could avoid having that space before the "d" in excel? ( I have checked with an indicator in labview and there is no space there when running ) ( and that space doesn't appear in any other column where I write some other stuff... )

Thanks again for ur help,

David
0 Kudos
Message 4 of 5
(2,594 Views)
Hi,

Is the space there when you check the file with notepad for instance?
0 Kudos
Message 5 of 5
(2,586 Views)