Java获取当前时间

package test;

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

public class NowTime {
    public static void main(String[] args) {
        Date nowDate=new Date();
        SimpleDateFormat sdf=new SimpleDateFormat("yyyy年MM月dd日 HH:mm:ss");
        String str=sdf.format(nowDate);
        System.out.println(str);
    }
}

 

posted @ 2016-09-06 12:31  IT~天空  阅读(731)  评论(0编辑  收藏  举报