Wednesday, May 20, 2009

Date format


Recently we have had a problem in csv export, that showed the dates in a different format after exporting some rows.
The problem file looked ok, but Microsoft Excel did not show it as we expected ,as showed up , because of the reason that the dates where in the en-US format ,and since we are Israelis, our computers work in he-IL , which is actually almost en-UK
When a date is 5/10 , excel assumes that it is fith of october (wich is still wrong but we don't care as long as it is a date) ;) , however when the date is 5/16 excel files to recognize the 16-th month (hextober, duh !) and shows the date as a string , wich driving our clients nuts

Great so far, because we know what is the problem but the solution was a little triky , because the whole application has culture preset to en-US and actually i was a little bit scarred to change it , therefore we used the dtColData.ToString("yyyy'-'MM'-'dd' 'HH':'mm':'ss") wich worked allright

No comments:

Post a Comment