Here you can find the source of getCalendarForTime(final long timeInMilliseconds)
Parameter | Description |
---|---|
timeInMilliseconds | the time in milliseconds from the Jan 1 1970 epoch that is to be used as the time to set the calendar to. |
public static Calendar getCalendarForTime(final long timeInMilliseconds)
//package com.java2s; import java.util.Calendar; import java.util.TimeZone; public class Main { /**//w w w .ja va2s.c o m * Function to return a calendar object holding the UTC representation of the current time. * @param timeInMilliseconds * the time in milliseconds from the Jan 1 1970 epoch that is to be used as the time to set * the calendar to. * @return * the calendar object which represents the time that was passed in in UTC */ public static Calendar getCalendarForTime(final long timeInMilliseconds) { Calendar calendar = Calendar.getInstance(TimeZone.getTimeZone("UTC")); calendar.setTimeInMillis(timeInMilliseconds); return calendar; } }