Under Linux, java format dates

General use of java in your computer simpleDateFormat Date format:

Format = SimpleDateFormat new new SimpleDateFormat ( "EEEE MM month dd day" ); 
String DATE = format.format ( new new a Date ()); 
System.out.println (DATE); // output "Monday, September 2"

But the code is run on Linux servers, the results obtained will be the date of "Tuesday" turned into "Monday", because linux is the default language is English.

 

Solution: Incoming time zone when defining SimpleDateFormat objects:

Format = SimpleDateFormat new new SimpleDateFormat ( "EEEE MM month dd day", Locale.SIMPLIFIED_CHINESE );    //Locale.SIMPLIFIED_CHINESE expressed as Chinese Simplified

result:

 

Guess you like

Origin www.cnblogs.com/yhood/p/11448070.html