Java Code Examples for android.text.format.Time#EPOCH_JULIAN_DAY
The following examples show how to use
android.text.format.Time#EPOCH_JULIAN_DAY .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Utils.java From narrate-android with Apache License 2.0 | 3 votes |
/** * Returns the week since {@link Time#EPOCH_JULIAN_DAY} (Jan 1, 1970) * adjusted for first day of week. * * 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; }
Example 2
Source File: Utils.java From ClockPlus with GNU General Public License v3.0 | 3 votes |
/** * Returns the week since {@link Time#EPOCH_JULIAN_DAY} (Jan 1, 1970) * adjusted for first day of week. * * 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; }
Example 3
Source File: Utils.java From BottomSheetPickers with Apache License 2.0 | 3 votes |
/** * Returns the week since {@link Time#EPOCH_JULIAN_DAY} (Jan 1, 1970) * adjusted for first day of week. * * 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; }
Example 4
Source File: Utils.java From Android-RecurrencePicker with Apache License 2.0 | 3 votes |
/** * Returns the week since {@link android.text.format.Time#EPOCH_JULIAN_DAY} (Jan 1, 1970) * adjusted for first day of week. * <p/> * This takes a julian day and the week start day and calculates which * week since {@link android.text.format.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 android.text.format.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; }
Example 5
Source File: Utils.java From DateTimepicker with Apache License 2.0 | 3 votes |
/** * Returns the week since {@link Time#EPOCH_JULIAN_DAY} (Jan 1, 1970) * adjusted for first day of week. * * 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; }
Example 6
Source File: Utils.java From StyleableDateTimePicker with MIT License | 3 votes |
/** * Returns the week since {@link Time#EPOCH_JULIAN_DAY} (Jan 1, 1970) * adjusted for first day of week. * * 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; }
Example 7
Source File: Utils.java From cathode with Apache License 2.0 | 3 votes |
/** * Returns the week since {@link Time#EPOCH_JULIAN_DAY} (Jan 1, 1970) * adjusted for first day of week. * * 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; }