12-25-2008 11:39 PM
Hi...
Am using excel easy table.vi to export my data to excel.....it contains a date field...When exported to excel,the date and month is getting interchenged.
ie,05/03/2008 is converted as 03/05/2008...What is the work around for this?
i read in one of the posts that have to format the date filed using Excel Set cell Format.vi..I tried wth that ,but so far cudnt fix...i tried wth using @ in the number format..then i was getting a string instead of datetime.When used%d/%m/%Y..then i was getting error.
If i can use that,how do i.
My datetime filed is the first column in the 2D array.
Thanks in advance...
12-26-2008 09:44 PM
Hi,
Excel handles date and time as a floating point decimal representation. The integral value (to the left of the decimal) represents the number of days since the beginning of the 20th century. The decimal value represents the time of day from midnight in seconds divided by 86,400 (i.e. 6:00:00PM = 0.75).
Excel chooses the default regional date format (i.e. MM/DD/YYYY, DD/MM/YYYY, etc.) based on your current location setting. You can manually change the format of a particular cell by right clicking on any cell and selecting 'Format Cells', then selecting 'Date', and finally changing the 'Locale (location)' to the desired format. This allows you to format the date however you'd like.
Unfortunately, Microsoft Excel does not have a text function to programatically change the 'Locale (location)' setting for a cell. This means that if you need to send a date through the Report Generation Toolkit that is in a format different from the current location setting, you will need to convert the date representation to text. This will change the way Excel handles the cell data from the date format mentioned above to a simple text sting. For example, if you're trying to convert the date '12/24/2008' in cell A1 into '24/12/2008', you can use the following code:
=TEXT(A1,"dd/mm/yyyy")
If you try to keep the cell formatted as a date, Excel will interpret '24' as a month and '12' as a date, which results in an incorrect date. There is no easy way to programatically convert this text string back into a date without manually changing the date format of the cell.
Credit: Ganesh Ganeshkumar
Regards, Kate
12-27-2008 09:37 AM