Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Latest commit

 

History

History
History
38 lines (36 loc) · 1.07 KB

File metadata and controls

38 lines (36 loc) · 1.07 KB
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
36
37
38
package other;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Scanner;
/**
* 神策数据
* 输入两行,第一行为时钟,第二行是经过的时间,输入时钟显示的结果
*
* 输入:
* 10:00:00
* 00:11:12
*
* 输出:
* 10:11:12
*
*/
public class ShenCe2 {
public static void main(String[] args){
Scanner scanner=new Scanner(System.in);
String line1=scanner.nextLine();
String line2=scanner.nextLine();
SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
SimpleDateFormat sdf2=new SimpleDateFormat("HH:mm:ss");
try {
Date date1=sdf.parse("2018-09-21 "+line1);
Date date2=sdf.parse("2018-09-21 "+line2);
Date date3=sdf.parse("2018-09-21 00:00:00");
Date date4=new Date(date1.getTime()+(date2.getTime()-date3.getTime()));
String ret=sdf2.format(date4);
System.out.println(ret);
} catch (ParseException e) {
e.printStackTrace();
}
}
}
Morty Proxy This is a proxified and sanitized view of the page, visit original site.