Calendar.setTimeInMillis(long value)Setting time by using UTC milliseconds from the epoch
Returns the new calendar object
Examples with output
We created on long type data and then used the same to assign setTimeInMillis for a calendar object.
package my_proj;
import java.util.Calendar;
public class my_first {
public static void main(String[] args) {
Calendar my_cal_d1 = Calendar.getInstance();// created calendar
long my_time=1000000000;
System.out.println( my_cal_d1.getTime());
my_cal_d1.setTimeInMillis(my_time);
System.out.println( my_cal_d1.getTime());
}
}
Output
Thu Mar 05 15:17:39 IST 2020
Mon Jan 12 19:16:40 IST 1970