I have a date format pattern: MMM yyyy
And want that: if the month name is short cuted a dot is printed after the name. But if the month name is not short cuted no dot is added.
Example:
- May 2010 should print:
May 2010(without dot) — May is only 3 letters long, so there is no dot needed, because it is not an abbreviation. - December 2100 should print:
Dec. 2010(with dot) — December is more than 3 letters long, so there is a dot needed, because it an abbreviation.
Is this possible with an pattern, or do I need to implement it by “hand”?
What you can do is use a custom
DateFormatSymbolsin your formatter, in which you override the short months array with one that contains “May” instead of “May.”.Update: Sorry, I got the last bit wrong, of course it should be the other way around, short months are originally “Jan”, “Feb” etc and you should replace them with “Jan.”, “Feb.” for every month except for May.