We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Get Pattern for Custom Date in Java

I am using the following code to get pattern for custom date in Java from Excel cell:
cell.getStyle().getCustom()

In Excel, I set the format as show in the screenshot below
The return value of getCustom is m/d/yy;@.

The problem is that m (lowercase) is a format for minutes as described here.

I would expect for getCustom to return MM/d/yy.

Is there a standard way to convert the values returned from getCustom to Java standard library format?

Tnx
image.png (8.3 KB)

@eyalmolad,
We have observed this scenario and logged it in our database for further investigation. You will be notified here once any update is ready for sharing.

This issue is logged as:
CELLSJAVA-43936 - getCustom() returns different string than expected value

@eyalmolad,

We have checked your file in MS Excel, MS Excel shows the custom pattern as “m/d/yy;” too, please see the attached screenshot. And in your template file, if you check the string saved in the xml file, it is “m/d/yy;” too. So we don’t think it is an issue for the returned custom string. And for the formatting code(pattern) of Style.Custom, the syntax is same with MS Excel, not any program with language.

If you need one new feature that support converting the format pattern of MS Excel to specific language, such as Java, we are afraid it is complicated and we cannot support it soon. As a component, we have to take all possible situations into consideration when implementing it. You may consider to convert some special patterns by themselves according to your requirement.

Anyways, if you still think this is a valuable feature and hard to solve it by yourselves, we can create a new feature request ticket and try to support it later on.
custom.png (42.4 KB)