Вопрос

Is it possible to get the non-zero-padded month number using setDateFormat?

If not, could you provide an alternative solution?

Это было полезно?

Решение

Use M instead of MM in the format string. If you use two letters, you specify that the result should have two digits, if you don't, the result can have one or two digits.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top