Java/Java

Java 17. String.format & SimpleDateFormat

shin96bc 2022. 5. 24. 14:43

(1) SimpleDateFormat

     1) Java 에서 현재 시각이나 어떤 시각을 특정 형식에 맞추어 출력할 때 사용한다.

     2) 사용법

          <1> 표현식 1 (날짜 & 시간)

출처:&nbsp;https://shyunku.tistory.com/33

         <2> 표현식 2 (날짜 & 시간 & 지역)

출처:&nbsp;https://shyunku.tistory.com/33

         <3> 태그 종류

             

출처:&nbsp;https://shyunku.tistory.com/33

 

(2) String.format

     1) 필수 값

출처:&nbsp;https://interconnection.tistory.com/116

     2) 문법

출처:&nbsp;https://interconnection.tistory.com/116

     3) 옵션

출처:&nbsp;https://interconnection.tistory.com/116

     4) 지역도 설정 가능

          <1> String str = String.format(Locale.US, "%05d/%05d", 1, 1);

 

 

참고자료:

https://shyunku.tistory.com/33

 

https://interconnection.tistory.com/116

 

 

'Java > Java' 카테고리의 다른 글

Java 16. GUI( Graphic User Interface )  (0) 2022.03.11
Java 15. NetWork  (0) 2022.03.11
Java 14. IO( Input Output )  (0) 2022.03.11
Java 13. 람다식  (0) 2022.03.11
Java 12. 쓰레드 ( Thread )  (0) 2022.03.11