格式化日期

package zuoye;

import java.text.SimpleDateFormat;
import java.util.Date;

public class Demo02 {

    //日期  并格式化   Date对象  SDF快捷键   Simpl..对象  
            //yyyy-MM-dd HH:mm:ss  -可以变为中文   年  月  日   可以用replace 重写
            //加上星期几   date.getDay   date.getMonth  两个方法  注意这里的月份是从0月开始
            
            //long time = System.curr...;
            //Day date = new Day(time);
            //System.out.println(date);
            
            
//            Calendar calendar = Calendar.getInstance();
////            月  ??
////            星期几??
    
    public static void main(String[] args) {
        
        Date date = new Date();
        
    SimpleDateFormat simpleDateFormat1 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        
        String formatDate1 = simpleDateFormat1.format(date);
        
        System.out.println(formatDate1);
        System.out.println("
---------------------------
");
        SimpleDateFormat simpleDateFormat2 = new SimpleDateFormat("yyyy年MM月dd日 HH:mm:ss");
        
        String formatDate2 = simpleDateFormat2.format(date);
        
        System.out.println(formatDate2);
    
        
    }
    
    
    
}

原文地址:https://www.cnblogs.com/bichen-01/p/11281337.html