IT/JAVA

[JAVA/자바] SimpleDateFormat 을 사용 해서 현재 시간 알아오기

JSOpg 2018. 9. 6. 18:56
 public static void main(String[] args) {
  // SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy년 MM월 dd일 a hh시 mm분 ss초 SSS");
  // SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
  SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd E요일");
  
  Date date = new Date(); // 현재 시간, 표준
  System.out.println("date : " + date);
  
  String strDate = dateFormat.format(date);
  System.out.println("strDate : " + strDate);
 }