Package io.prestosql.util
Class DateTimeUtils
- java.lang.Object
-
- io.prestosql.util.DateTimeUtils
-
public final class DateTimeUtils extends Object
-
-
Method Summary
All Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static long
convertToTimestampWithTimeZone(TimeZoneKey timeZoneKey, String timestampWithTimeZone)
Parse a string (optionally containing a zone) as a value of TIMESTAMP WITH TIME ZONE type.static int
parseDate(String value)
static long
parseDayTimeInterval(String value, IntervalLiteral.IntervalField startField, Optional<IntervalLiteral.IntervalField> endField)
static long
parseLegacyTime(TimeZoneKey timeZoneKey, String value)
Deprecated.applicable in legacy timestamp semantics onlystatic long
parsePeriodMillis(org.joda.time.format.PeriodFormatter periodFormatter, String value, IntervalLiteral.IntervalField startField, IntervalLiteral.IntervalField endField)
static long
parseYearMonthInterval(String value, IntervalLiteral.IntervalField startField, Optional<IntervalLiteral.IntervalField> endField)
static String
printDate(int days)
static String
printTimestampWithTimeZone(long timestampWithTimeZone)
static String
printTimeWithoutTimeZone(long value)
static String
printTimeWithoutTimeZone(TimeZoneKey timeZoneKey, long value)
Deprecated.applicable in legacy timestamp semantics onlystatic String
printTimeWithTimeZone(long timeWithTimeZone)
-
-
-
Method Detail
-
parseDate
public static int parseDate(String value)
-
printDate
public static String printDate(int days)
-
convertToTimestampWithTimeZone
public static long convertToTimestampWithTimeZone(TimeZoneKey timeZoneKey, String timestampWithTimeZone)
Parse a string (optionally containing a zone) as a value of TIMESTAMP WITH TIME ZONE type. If the string doesn't specify a zone, it is interpreted intimeZoneKey
zone.For example:
"2000-01-01 01:23:00"
is parsed to TIMESTAMP WITH TIME ZONE2000-01-01T01:23:00 <provided zone>
and"2000-01-01 01:23:00 +01:23"
is parsed to TIMESTAMP WITH TIME ZONE2000-01-01T01:23:00.000+01:23
.- Returns:
- stack representation of TIMESTAMP WITH TIME ZONE type
-
printTimestampWithTimeZone
public static String printTimestampWithTimeZone(long timestampWithTimeZone)
-
parseLegacyTime
@Deprecated public static long parseLegacyTime(TimeZoneKey timeZoneKey, String value)
Deprecated.applicable in legacy timestamp semantics onlyParse a string (without a zone) as a value of TIME type, interpreted intimeZoneKey
zone.- Returns:
- stack representation of legacy TIME type
-
printTimeWithTimeZone
public static String printTimeWithTimeZone(long timeWithTimeZone)
-
printTimeWithoutTimeZone
public static String printTimeWithoutTimeZone(long value)
-
printTimeWithoutTimeZone
@Deprecated public static String printTimeWithoutTimeZone(TimeZoneKey timeZoneKey, long value)
Deprecated.applicable in legacy timestamp semantics only
-
parseDayTimeInterval
public static long parseDayTimeInterval(String value, IntervalLiteral.IntervalField startField, Optional<IntervalLiteral.IntervalField> endField)
-
parsePeriodMillis
public static long parsePeriodMillis(org.joda.time.format.PeriodFormatter periodFormatter, String value, IntervalLiteral.IntervalField startField, IntervalLiteral.IntervalField endField)
-
parseYearMonthInterval
public static long parseYearMonthInterval(String value, IntervalLiteral.IntervalField startField, Optional<IntervalLiteral.IntervalField> endField)
-
-