AM/PM designator tt in custom date-time format string not working

I am trying to apply a style to cells that contain a date time value. The cells were populated by importing from a dataview. The built-in number format 22 is close to what I want, but doesn’t include the AM/PM part. So I am using a custom format string incorporating the tt part, but when I apply the style it does not convert the tt to the AM/PM designator, but passes it through as a literal value. Is this a bug? How do I represent the AM/PM designator in a custom format string?

Hi,


Well, Aspose.Cells works the same way as MS Excel does, so if MS Excel converts you so called tt part into the DateTime value properly, the Aspose.Cells will do the same. You may input the value and specify the custom formatting in MS Excel manually if it works fine or not

By the way, for your needs, you may try to use the following custom formatting:
“m/d/yy hh:mm AM/PM”, it may work for your needs.

And, if you think Ms Excel does work differently and fine, you may create a sample application, zip it and post it here to show the issue on our end. We will check your issue soon.

Thank you.

Thank you for your reply to my question. You provided exactly the answer I needed. I didn’t realize that Aspose.Cells adheres to the native Excel formatting tokens, and assumed instead that Cells used the .NET tokens. Anyway, my custom formatting is now working OK. I couldn’t find this anywhere in the Cells documentation on formatting - so I suggest you include it.

Hi,


Good to know that your issue is sorted out. And, yes, Aspose.Cells works the same way as MS Excel does. Regarding adding all custom formatting strings on Wiki Docs, well, I think we may not cover or list all possible MS Excel’s custom number formatting strings (which are quite a lot you know) as we only cover built-in number formatting, e.g. see the document for reference:
http://www.aspose.com/docs/display/cellsnet/Setting+Display+Formats+of+Numbers+and+Dates


Thank you.

Hi,

Actually I did see the documentation article about formatting that you referred. However, it was evident to me in that article that Aspose.Cells uses the identical strings as Excel uses. First it covered the Excel formatting dialog, and then it jumped to the list of built-in number formats. Maybe I missed something, but it would have helped to make that explicit in that article.

Thanks again

Hi,

Thanks for your posting and using Aspose.Cells.

Thanks for your valuable suggestion. We will try to make articles better in future as per your suggestions.