Skip to content

Instantly share code, notes, and snippets.

@kryvoboker
Created May 19, 2020 17:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kryvoboker/215361ce5eac4e4c56d82e8823703726 to your computer and use it in GitHub Desktop.
Save kryvoboker/215361ce5eac4e4c56d82e8823703726 to your computer and use it in GitHub Desktop.
HomeWork7
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package ru.live.kamaz_cs;
import java.util.Calendar;
import java.util.Date;
/**
*
* @author kamaz
*/
public class Main {
public static void main(String[] args) {
Calendar clOne = Calendar.getInstance();
Date dateOne = clOne.getTime();
Calendar clTwo = Calendar.getInstance();
clTwo.set(Calendar.YEAR, 2020);
clTwo.set(Calendar.MONTH, 3);
clTwo.set(Calendar.DAY_OF_MONTH, 19);
Date dateTwo = clTwo.getTime();
long timeOne = dateOne.getTime();
long timeTwo = dateTwo.getTime();
long timeThree = timeOne - timeTwo;
System.out.println("Time from " + dateTwo + " to " + dateOne + " = " + timeThree);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment