Skip to content

Instantly share code, notes, and snippets.

@Yur-ok
Created December 5, 2015 18:16
Show Gist options
  • Select an option

  • Save Yur-ok/675a9a4a2e2083220daf to your computer and use it in GitHub Desktop.

Select an option

Save Yur-ok/675a9a4a2e2083220daf to your computer and use it in GitHub Desktop.
D:H:M:S
package Lesson1_frame5;
/**
* Created by Юрий on 05.12.2015.
*/
public class TimeMillis {
public static void main(String[] args) {
long ms = System.currentTimeMillis();
System.out.println(ms);
long seconds = ms / 1000;
long minuts = seconds / 60;
int hours = (int)minuts / 60;
int days = hours / 24;
System.out.println(days + ":" + hours + ":" + minuts + ":" + seconds);
}
}
@Yur-ok
Copy link
Author

Yur-ok commented Dec 5, 2015

В вашем видео ответе, программа запускалась 28 января 2014 года в 08:26:59, верно?

@liuiv15
Copy link

liuiv15 commented Dec 6, 2015

Когда запускалась программа в видео, я не знаю, да это и не важно. Важно другое: это ваш результат 16775:402613:24156786:1449407170. Он не верен, так как, например,ни минуты ни секунды не могут быть больше 59.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment