forked from txs72/JavaTutorial
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathShowCurrentTime.java
More file actions
executable file
·35 lines (33 loc) · 1008 Bytes
/
ShowCurrentTime.java
File metadata and controls
executable file
·35 lines (33 loc) · 1008 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
/* */ package ch02;
/* */
/* */ public class ShowCurrentTime
/* */ {
/* */ public static void main(String[] args) {
/* 6 */ long totalMilliseconds = System.currentTimeMillis();
/* */
/* */
/* 9 */ long totalSeconds = totalMilliseconds / 1000L;
/* */
/* */
/* 12 */ long currentSecond = totalSeconds % 60L;
/* */
/* */
/* 15 */ long totalMinutes = totalSeconds / 60L;
/* */
/* */
/* 18 */ long currentMinute = totalMinutes % 60L;
/* */
/* */
/* 21 */ long totalHours = totalMinutes / 60L;
/* */
/* */
/* 24 */ long currentHour = totalHours % 24L;
/* */
/* */
/* 27 */ System.out.println("Current time is " + currentHour + ":" + currentMinute + ":" + currentSecond + " GMT");
/* */ }
/* */ }
/* Location: /Volumes/TXS.128G/hope useful/practice/2020.jar!/ch02/ShowCurrentTime.class
* Java compiler version: 8 (52.0)
* JD-Core Version: 1.1.3
*/