public class DateUtil extends Object
Modifier and Type | Class and Description |
---|---|
static interface |
DateUtil.DateTimeParser |
Modifier and Type | Field and Description |
---|---|
static String |
DEFAULT_DATE_FORMAT |
static Format |
DEFAULT_DATE_FORMATTER |
static String |
DEFAULT_MS_DATE_FORMAT |
static Format |
DEFAULT_MS_DATE_FORMATTER |
static String |
DEFAULT_TIME_FORMAT |
static Format |
DEFAULT_TIME_FORMATTER |
static String |
DEFAULT_TIME_ZONE_ID |
static String |
DEFAULT_TIMESTAMP_FORMAT |
static Format |
DEFAULT_TIMESTAMP_FORMATTER |
static String |
LOCAL_TIME_ZONE_ID |
Modifier and Type | Method and Description |
---|---|
static Format |
getDateFormatter(String pattern) |
static DateUtil.DateTimeParser |
getDateTimeParser(String pattern,
PDataType pDataType) |
static DateUtil.DateTimeParser |
getDateTimeParser(String pattern,
PDataType pDataType,
String timeZoneId) |
static Format |
getTimeFormatter(String pattern) |
static Timestamp |
getTimestamp(BigDecimal bd)
Utility function to convert a
BigDecimal value to Timestamp . |
static Timestamp |
getTimestamp(long millis,
int nanos)
Utility function to work around the weirdness of the
Timestamp constructor. |
static Format |
getTimestampFormatter(String pattern) |
static Date |
parseDate(String dateValue) |
static Time |
parseTime(String timeValue) |
static Timestamp |
parseTimestamp(String timestampValue) |
public static final String DEFAULT_TIME_ZONE_ID
public static final String LOCAL_TIME_ZONE_ID
public static final String DEFAULT_MS_DATE_FORMAT
public static final Format DEFAULT_MS_DATE_FORMATTER
public static final String DEFAULT_DATE_FORMAT
public static final Format DEFAULT_DATE_FORMATTER
public static final String DEFAULT_TIME_FORMAT
public static final Format DEFAULT_TIME_FORMATTER
public static final String DEFAULT_TIMESTAMP_FORMAT
public static final Format DEFAULT_TIMESTAMP_FORMATTER
public static DateUtil.DateTimeParser getDateTimeParser(String pattern, PDataType pDataType, String timeZoneId)
public static DateUtil.DateTimeParser getDateTimeParser(String pattern, PDataType pDataType)
public static Timestamp getTimestamp(long millis, int nanos)
Timestamp
constructor.
This method takes the milli-seconds that spills over to the nanos part as part of
constructing the Timestamp
object.
If we just set the nanos part of timestamp to the nanos passed in param, we
end up losing the sub-second part of timestamp.public static Timestamp getTimestamp(BigDecimal bd)
BigDecimal
value to Timestamp
.Copyright © 2015 Apache Software Foundation. All Rights Reserved.