Android Question MM not giving the right month?

dbprogramer

Member
Licensed User
Longtime User
When I change the date format from "m" ("mm...") to "M...", instead of showing the correct month it always shows January. I can even have both "MM" and "mm" together in the format and the lower case (which shows the month as a number) will be correct while the capital M will always show January! Is this a problem in the compiler? Am I missing something in my formatting? If I add the day of the week, even with "mm" it is incorrect.

This is what I want: (expected result: "Saturday, February 10, 2018") [today]
DateTime.DateFormat="EEEE, MMMM d, yyyy" (result: "Wednesday, January 10, 2018) -- wrong day of week and wrong month!
DateTime.DateFormat="EEEE, mm d, yyyy" (result: "Wednesday, 02 10, 2018) -- month is right but not day of week!
 

DonManfred

Expert
Licensed User
Longtime User
Upvote 0

dbprogramer

Member
Licensed User
Longtime User
Thanks for the quick response; I've been referring to that page, but of course as you see I was mixing up the "m" for minutes and thinking it was month as a number and "M" as month by name. The problem, I suppose, was that I had set the initial format as "mm d, yyyy" (which does not include a month) then when I changed it to MMMM d, yyyyy to display it, there was no month included and it must have defaulted to January. Thanks again for responding!
 
Upvote 0
Top