Skip to content

Instantly share code, notes, and snippets.

@jjangga0214
Last active September 21, 2017 07:16
Show Gist options
  • Select an option

  • Save jjangga0214/ade0306261afc3d5e4c86a1574c12c83 to your computer and use it in GitHub Desktop.

Select an option

Save jjangga0214/ade0306261afc3d5e4c86a1574c12c83 to your computer and use it in GitHub Desktop.
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
public class DateDemo {
public static void main(String[] args) {
LocalDate localDate = LocalDate.now(); // 연월일만 정보를 가지는 날짜 객체
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy년 M월 dd일");//날짜 형식 지정객체
String dateFormatted = localDate.format(formatter);//날짜 형식 지정
System.out.println(localDate);// 기본 포맷으로 날짜 출력
System.out.println(dateFormatted);// 커스텀된 형식으로 날짜 출력
String msg = String.format("%d월 ",10); //String 자체를 formatting 하는 것
System.out.println(msg);
System.out.printf("%d월",10); //출력시에만 formatting 하는 것
}
}
@jjangga0214
Copy link
Author

이 부분은 ~~~ 이랬으면??

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment