NSDateFormatter setDateFormat non-zero-padded month number
Asked Answered
N

1

8

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

If not, could you provide an alternative solution?

Noli answered 25/4, 2012 at 0:6 Comment(0)
H
12

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.

Hydrogenous answered 25/4, 2012 at 0:11 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.