List of usage examples for android.text.format Time EPOCH_JULIAN_DAY
int EPOCH_JULIAN_DAY
To view the source code for android.text.format Time EPOCH_JULIAN_DAY.
Click Source Link
From source file:Main.java
/** * Returns the week since {@link Time#EPOCH_JULIAN_DAY} (Jan 1, 1970) * adjusted for first day of week.//from w w w . j ava2 s .c o m * <p/> * This takes a julian day and the week start day and calculates which * week since {@link Time#EPOCH_JULIAN_DAY} that day occurs in, starting * at 0. *Do not* use this to compute the ISO week number for the year. * * @param julianDay The julian day to calculate the week number for * @param firstDayOfWeek Which week day is the first day of the week, * see {@link Time#SUNDAY} * @return Weeks since the epoch */ public static int getWeeksSinceEpochFromJulianDay(int julianDay, int firstDayOfWeek) { int diff = Time.THURSDAY - firstDayOfWeek; if (diff < 0) { diff += 7; } int refDay = Time.EPOCH_JULIAN_DAY - diff; return (julianDay - refDay) / 7; }