Need date formate like yyyy-MM-dd with time like "2008-07-08 20:24:14" in Excel
-
Hi all, As per my requirement, while displaying date (i.e audit column) in datagrid is coming fine but same column while displaying in excel formate it is displaying as "2008-07-08" unable to get this (2008-07-08 20:24:14) formate i am using the following code sbrHTML.Append(";.premium { mso-number-format:$\\#\\,\\#\\#0\\.00;} .ogDate {mso-ignore:padding;mso-generic-font-family:auto;mso-font-charset:0;mso-number-format:yyyy-MM-dd;mso-background-source:auto;mso-pattern:auto;} ;"); then i am applying style for audit like the following sbrHTML.Append(";" + (sqlDatareader.IsDBNull(columnIndex) ? "" : sqlDatareader["AUDIT_DATE"].ToString() + ";")); ogDate For the above stmt i am able to get only this formate "2008-07-08" but i need to include time also. Could any one help me in mso-number-formate: to get date formate like "2008-07-08 20:24:14" thanks, eswar.
-
Hi all, As per my requirement, while displaying date (i.e audit column) in datagrid is coming fine but same column while displaying in excel formate it is displaying as "2008-07-08" unable to get this (2008-07-08 20:24:14) formate i am using the following code sbrHTML.Append(";.premium { mso-number-format:$\\#\\,\\#\\#0\\.00;} .ogDate {mso-ignore:padding;mso-generic-font-family:auto;mso-font-charset:0;mso-number-format:yyyy-MM-dd;mso-background-source:auto;mso-pattern:auto;} ;"); then i am applying style for audit like the following sbrHTML.Append(";" + (sqlDatareader.IsDBNull(columnIndex) ? "" : sqlDatareader["AUDIT_DATE"].ToString() + ";")); ogDate For the above stmt i am able to get only this formate "2008-07-08" but i need to include time also. Could any one help me in mso-number-formate: to get date formate like "2008-07-08 20:24:14" thanks, eswar.
In Excel you can format the cell with a Custom format of yyyy-mm-dd hh:mm:ss or as a Date with International (ISO) locale. How you'd set that via C# I don't know.
-
Hi all, As per my requirement, while displaying date (i.e audit column) in datagrid is coming fine but same column while displaying in excel formate it is displaying as "2008-07-08" unable to get this (2008-07-08 20:24:14) formate i am using the following code sbrHTML.Append(";.premium { mso-number-format:$\\#\\,\\#\\#0\\.00;} .ogDate {mso-ignore:padding;mso-generic-font-family:auto;mso-font-charset:0;mso-number-format:yyyy-MM-dd;mso-background-source:auto;mso-pattern:auto;} ;"); then i am applying style for audit like the following sbrHTML.Append(";" + (sqlDatareader.IsDBNull(columnIndex) ? "" : sqlDatareader["AUDIT_DATE"].ToString() + ";")); ogDate For the above stmt i am able to get only this formate "2008-07-08" but i need to include time also. Could any one help me in mso-number-formate: to get date formate like "2008-07-08 20:24:14" thanks, eswar.