Package org.apache.orc.impl
Class DateUtils
java.lang.Object
org.apache.orc.impl.DateUtils
Conversion utilities from the hybrid Julian/Gregorian calendar to/from the
proleptic Gregorian.
The semantics here are to hold the string representation constant and change the epoch offset rather than holding the instant in time constant and change the string representation.
These utilities will be fast for the common case (> 1582 AD), but slow for old dates.
-
Method Summary
Modifier and TypeMethodDescriptionstatic int
convertDate
(int original, boolean fromProleptic, boolean toProleptic) static int
convertDateToHybrid
(int proleptic) Convert an epoch day from the proleptic Gregorian calendar to the hybrid Julian/Gregorian.static int
convertDateToProleptic
(int hybrid) Convert an epoch day from the hybrid Julian/Gregorian calendar to the proleptic Gregorian.static long
convertTime
(long original, boolean fromProleptic, boolean toProleptic, boolean useUtc) static long
convertTimeToHybrid
(long proleptic, boolean useUtc) Convert epoch millis from the proleptic Gregorian calendar to the hybrid Julian/Gregorian.static long
convertTimeToProleptic
(long hybrid, boolean useUtc) Convert epoch millis from the hybrid Julian/Gregorian calendar to the proleptic Gregorian.static DateTimeFormatter
getTimeFormat
(boolean useProleptic, boolean useUtc) static Integer
static Long
static String
printDate
(int date, boolean fromProleptic) static String
printTime
(long millis, boolean fromProleptic, boolean useUtc)
-
Method Details
-
convertDateToProleptic
public static int convertDateToProleptic(int hybrid) Convert an epoch day from the hybrid Julian/Gregorian calendar to the proleptic Gregorian.- Parameters:
hybrid
- day of epoch in the hybrid Julian/Gregorian- Returns:
- day of epoch in the proleptic Gregorian
-
convertDateToHybrid
public static int convertDateToHybrid(int proleptic) Convert an epoch day from the proleptic Gregorian calendar to the hybrid Julian/Gregorian.- Parameters:
proleptic
- day of epoch in the proleptic Gregorian- Returns:
- day of epoch in the hybrid Julian/Gregorian
-
convertTimeToProleptic
public static long convertTimeToProleptic(long hybrid, boolean useUtc) Convert epoch millis from the hybrid Julian/Gregorian calendar to the proleptic Gregorian.- Parameters:
hybrid
- millis of epoch in the hybrid Julian/GregorianuseUtc
- use UTC instead of local- Returns:
- millis of epoch in the proleptic Gregorian
-
convertTimeToHybrid
public static long convertTimeToHybrid(long proleptic, boolean useUtc) Convert epoch millis from the proleptic Gregorian calendar to the hybrid Julian/Gregorian.- Parameters:
proleptic
- millis of epoch in the proleptic GregorianuseUtc
- use UTC instead of local- Returns:
- millis of epoch in the hybrid Julian/Gregorian
-
convertDate
public static int convertDate(int original, boolean fromProleptic, boolean toProleptic) -
convertTime
public static long convertTime(long original, boolean fromProleptic, boolean toProleptic, boolean useUtc) -
parseDate
-
printDate
-
getTimeFormat
-
parseTime
-
printTime
-