Custom date time formatting

Hello!

I need to format date and time in a custom manner, like this: “dd-mm-yyyy; hh-mm”
When I try to specify my format
style.setCustom("dd-MM-yyyy; HH:mm")
the “;” symbole ignores.
How should I set my custom format to print ; ?
Thanks in advance!

@bobryashov,

I have tried same custom format in Excel 365 for date and observed that Excel also ignores ‘;’ and value after ‘;’. It is default behavior of Excel and cannot be avoided using Aspose.Cells. You may please try it in Excel and if it works, please provide us the template Excel file for our analysis.

@bobryashov,

We have further investigated it and have found that ‘;’ is a special character in formatting pattern, so it should be escaped by ‘\’ or quoted by “”. You may try the code:

style.setCustom(“dd-MM-yyyy\; HH:mm”)

or

style.setCustom(“dd-MM-yyyy”;" HH:mm")

Let us know your feedback.