The datetime formatting for milliseconds is not working.
I’ve tried the following:
dateStyle.Custom = “m/d/yyyy h:mm:ss.0 AM/PM”;
dateStyle.Custom = “m/d/yyyy h:mm:ss.000 AM/PM”;
The datetime formatting for milliseconds is not working.
I’ve tried the following:
dateStyle.Custom = “m/d/yyyy h:mm:ss.0 AM/PM”;
dateStyle.Custom = “m/d/yyyy h:mm:ss.000 AM/PM”;
Hi,
Thanks for your posting and using Aspose.Cells.
Please provide us your sample excel file which should have a datetime value in your required format. You can create it manually using Microsoft Excel and attach it here. It will help us investigate this issue and we will provide you a sample code/date format pattern string to resolve this issue.
Thanks for your cooperation.
Here is the code:
var dateStyle = wb.CreateStyle();
dateStyle.Custom = “m/d/yyyy h:mm:ss AM/PM”;
var dateStyleFlag = new StyleFlag { NumberFormat = true };
// Dates need to appear correctly since calling ConvertStringToNumericValue messes them up
foreach (Cell c in sheet.Cells.Rows[0])
{
if(c.Value.ToString().ToUpper().Contains(“UTC”) || c.Value.ToString().Trim().ToUpper().Equals(“TIME”)) sheet.Cells.Columns[c.Column].ApplyStyle(dateStyle, dateStyleFlag);
}
sheet.AutoFitColumns();
Hi Annette,