현재 날짜 구하기
LocalDate now = LocalDate.now() // 2024-07-02
지역별 현재 날짜 구하기
LocalDate SeoulNow = LocalDate.now(ZoneId.of("Asia/Seoul"));
LocalDate LondonNow = LocalDate.now(ZoneId.of("Europe/London"));
현재 시간 구하기
LocalTime now = LocalTime.now(); // 22:01:11.009381700
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("HH시 mm분 ss초");
String formatedNow = now.format(formatter);
- DateTimeFormatter 클래스를 이용하여 시간을 원하는 포맷의 문자열로 변환
int hour = now.getHour();
int minute = now.getMinute();
int second = now.getSecond();
- getHour(), getMinute(), getSecond() 메소드를 이용해 시, 분, 초를 추출할 수 있다.
현재 날짜/시간
LocalDateTime now = LocalDateTime.now();
//2024-07-02T22:01:11.009381700
게시글 검색 기능
'JAVA' 카테고리의 다른 글
JAVA(07.04) - ArticleManager(Controller - Service - Dao - (DB)) (0) | 2024.07.04 |
---|---|
JAVA(07.03) - ArticleManager(Switch case문, 간소화) (0) | 2024.07.03 |
JAVA(07.01) - MVC pattern (0) | 2024.07.01 |
JAVA(07.01) - motivation(삭제, 수정기능, String toString() 메소드) (0) | 2024.07.01 |
JAVA(06.28) - motivation(Refactoring, Parsing) (0) | 2024.06.28 |