format

파싱(Parsing) String으로 표현된 날짜형식을 LocalDate, LocalDateTime 으로 변환시켜준다. DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy.MM.dd"); LocalDate localDate = LocalDate.parse("2024.05.21", formatter); DateTimeFormatter를 설정해 주지 않으면 기본적으로 ISO_LOCAL_DATE 포멧터를 사용해서 파싱한다.(yyyy-MM-dd 형식) 포멧팅(Formatting) 날짜형식을 문자열로 변환시키켜준다. LocalDateTime now = LocalDateTime.now(); DateTimeFormatter dateTimeFormatter..
Format 클래스 형식 클래스는 java.text 패키지에 포함되어 있다. 숫자 형식 : DecimalFormat 날짜 형식 : SimpleDateFormat 문자열 형식 : MessageFormat 숫자 형식 클래스(DecimalFormat) DecimalFormat df = new DecimalFormat("#,###.0"); String result = df.format("1234567.89"); 기호 의미 패턴 예 1234567.89 변환결과 0 10진수(빈자리는 0으로 채움) 0 0.0 0000000000.0000 1234568 1234567.9 0001234567.8900 # 10진수(빈자리는 채우지 않음) # #.# ##########.#### 1234568 . 소수점 #.0 1234567..
깡냉쓰
'format' 태그의 글 목록