-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtime-conversion.java
More file actions
35 lines (24 loc) · 894 Bytes
/
Copy pathtime-conversion.java
File metadata and controls
35 lines (24 loc) · 894 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import java.io.*;
import java.math.*;
import java.text.*;
import java.util.*;
import java.util.regex.*;
import java.text.SimpleDateFormat;
import java.util.Date;
public class Solution {
static String timeConversion(String s) throws ParseException{
SimpleDateFormat output = new SimpleDateFormat("HH:mm:ss");
SimpleDateFormat input = new SimpleDateFormat("hh:mm:ssaa");
Date time = input.parse(s);
return output.format(time);
}
private static final Scanner scan = new Scanner(System.in);
public static void main(String[] args) throws IOException,ParseException {
BufferedWriter bw = new BufferedWriter(new FileWriter(System.getenv("OUTPUT_PATH")));
String s = scan.nextLine();
String result = timeConversion(s);
bw.write(result);
bw.newLine();
bw.close();
}
}