Last active
September 21, 2017 07:16
-
-
Save jjangga0214/ade0306261afc3d5e4c86a1574c12c83 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 하는 것 | |
| } | |
| } |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
이 부분은 ~~~ 이랬으면??