-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathExercise15.java
More file actions
22 lines (19 loc) · 909 Bytes
/
Exercise15.java
File metadata and controls
22 lines (19 loc) · 909 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
public class Exercise15 {
public static void main(String arg[]) {
// Write a program that prints out how many days, hours, minutes,
// and seconds it has been since midnight on January 1, 1970.
// For this question, make use of the System.currentTimeMillis()
// function in Java which will give you the number of milliseconds
// since midnight on January 1, 1970.
long n = System.currentTimeMillis();
System.out.println("It has been " + n + " milliseconds since midnight Jan 1, 1970.");
long d = ...; // add your code here, then click "run" to test it.
long h = ...;
long m = ...;
double s = ...;
System.out.println("That is " + d + " days, " +
h + " hours, " +
m + " minutes, and " +
s + " seconds ago!");
}
}