Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Month and java.util.Formatter

In the javadoc of java.util.Formatter I read:

'm' Month, formatted as two digits with leading zeros as necessary, i.e. 01 - 13.

Why 13?

like image 277
Lachezar Balev Avatar asked Oct 22 '12 08:10

Lachezar Balev


People also ask

How do I change the date format in Java Util?

// Setting the pattern SimpleDateFormat sm = new SimpleDateFormat("mm-dd-yyyy"); // myDate is the java. util. Date in yyyy-mm-dd format // Converting it into String using formatter String strDate = sm. format(myDate); //Converting the String back to java.

Is SimpleDateFormat deprecated?

Deprecated. NOT IMPLEMENTED - use SimpleDateFormat for parsing instead.

What is T and Z in timestamp Java?

The T is just a literal to separate the date from the time, and the Z means “zero hour offset” also known as “Zulu time” (UTC). If your strings always have a “Z” you can use: SimpleDateFormat format = new SimpleDateFormat( “yyyy-MM-dd'T'HH:mm:ss).


2 Answers

Javadoc explains why..

'm' '\u006d' Month, formatted as two digits with leading zeros as necessary, i.e. 01 - 13, where "01" is the first month of the year and ("13" is a special value required to support lunar calendars).

like image 123
Nandkumar Tekale Avatar answered Sep 21 '22 23:09

Nandkumar Tekale


'm' Month, formatted as two digits with leading zeros as necessary,
 i.e. 01 - 13, where "01" is the first month of the year and ("13" is a special 
 value required to support lunar calendars).
like image 33
Sumit Singh Avatar answered Sep 21 '22 23:09

Sumit Singh