Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.*;
- public class Main{
- public static void main(String[] args){
- Scanner read = new Scanner(System.in);
- int total_sec = read.nextInt();
- final int sec_per_year = (60*60*24*360);
- final int sec_per_month = (60*60*24*30);
- final int sec_per_day = (60*60*24);
- final int sec_per_hour = (60*60);
- final int sec_per_min = (60);
- int year = total_sec/sec_per_year;
- int temp = total_sec % sec_per_year;
- int month = temp/sec_per_month;
- temp = temp % sec_per_month;
- int day = temp/sec_per_day;
- temp = temp % sec_per_day;
- int hour = temp/sec_per_hour;
- temp = temp % sec_per_hour;
- int min = temp/sec_per_min;
- int sec = temp % sec_per_min;
- System.out.println("Seconds Since Unix Epoch:" + total_sec);
- System.out.println("Year:" + (year + 1970));
- System.out.println("Month:" + month);
- System.out.println("Day:" + day);
- System.out.println("Hour:" + hour);
- System.out.println("Min:" + min);
- System.out.println("Sec:" + sec);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement