티스토리 뷰

 

소스코드

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
import java.time.*;
import java.time.format.DateTimeFormatter;
import java.util.*;
 
public class Main{
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int h = sc.nextInt();
        int m = sc.nextInt();
        LocalDateTime date = LocalDateTime.of(201911, h, m);
        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("H m");
   
        System.out.println(date.minusMinutes(45).format(formatter));
    }
}
cs

날짜 포맷

h = 12 시간 표기

H = 24 시간 표기