My C# application send a formatted date (ex: 9/6/2010 – dd/mm/yyyy) to an excel spreadsheet… but then… it comes to 6/9/2010! (mm/dd/yyyy)
I just use the following code to send the date:
VarRowColumnWhatever = _MyList.MyObject.MyDateTime.Date.ToString();
Debbuging it, i can see that the value are correct! But not in the spreadsheet =(
I began to think that is something to do with Excel…
Someone please can help me? Thanks!
Stick a string according to the pattern you want into the ToString() portion.
For instance, to get the Full Day, Month, Date, Year, i’d put:
_MyList.MyObject.MyDateTime.TimeOfDay.ToString(“D”);
which would output the string: “Wednesday, June 23, 2010”
// This example displays the following output to the console:
// d: 6/15/2008
// D: Sunday, June 15, 2008
// f: Sunday, June 15, 2008 9:15 PM
// F: Sunday, June 15, 2008 9:15:07 PM
// g: 6/15/2008 9:15 PM
// G: 6/15/2008 9:15:07 PM
// m: June 15
// o: 2008-06-15T21:15:07.0000000
// R: Sun, 15 Jun 2008 21:15:07 GMT
// s: 2008-06-15T21:15:07
// t: 9:15 PM
// T: 9:15:07 PM
// u: 2008-06-15 21:15:07Z
// U: Monday, June 16, 2008 4:15:07 AM
// y: June, 2008
//
// ‘h:mm:ss.ff t’: 9:15:07.00 P
// ‘d MMM yyyy’: 15 Jun 2008
// ‘HH:mm:ss.f’: 21:15:07.0
// ‘dd MMM HH:mm:ss’: 15 Jun 21:15:07
// ‘\Mon\t\h: M’: Month: 6
// ‘HH:mm:ss.ffffzzz’: 21:15:07.0000-07:00