public class DateTimeUtil extends Object
| Constructor and Description |
|---|
DateTimeUtil() |
| Modifier and Type | Method and Description |
|---|---|
static org.joda.time.DateTime |
copy(org.joda.time.DateTime value)
Null-safe method of copying a DateTime
NOTE: The timestamp also should be in UTC. |
static org.joda.time.DateTime |
floorToDay(org.joda.time.DateTime value)
Null-safe method that returns a new instance of a DateTime object rounded
downwards to the nearest day.
|
static org.joda.time.DateTime |
floorToFiveMinutes(org.joda.time.DateTime value)
Null-safe method that returns a new instance of a DateTime object rounded
downwards to the nearest 5 minutes.
|
static org.joda.time.DateTime |
floorToHalfHour(org.joda.time.DateTime value)
Null-safe method that returns a new instance of a DateTime object rounded
downwards to the nearest half hour (30 minutes).
|
static org.joda.time.DateTime |
floorToHour(org.joda.time.DateTime value)
Null-safe method that returns a new instance of a DateTime object rounded
downwards to the nearest hour.
|
static org.joda.time.DateTime |
floorToMinute(org.joda.time.DateTime value)
Null-safe method that returns a new instance of a DateTime object rounded
downwards to the nearest minute.
|
static org.joda.time.DateTime |
floorToMinutePeriod(org.joda.time.DateTime value,
int periodInMinutes)
Null-safe method that returns a new instance of a DateTime object rounded
downwards to the nearest specified period in minutes.
|
static org.joda.time.DateTime |
floorToMonth(org.joda.time.DateTime value)
Null-safe method that returns a new instance of a DateTime object rounded
downwards to the nearest month.
|
static org.joda.time.DateTime |
floorToQuarterHour(org.joda.time.DateTime value)
Null-safe method that returns a new instance of a DateTime object rounded
downwards to the nearest 15 minutes.
|
static org.joda.time.DateTime |
floorToSecond(org.joda.time.DateTime value)
Null-safe method that returns a new instance of a DateTime object rounded
downwards to the nearest second.
|
static org.joda.time.DateTime |
floorToTenMinutes(org.joda.time.DateTime value)
Null-safe method that returns a new instance of a DateTime object rounded
downwards to the nearest 10 minutes.
|
static org.joda.time.DateTime |
floorToYear(org.joda.time.DateTime value)
Null-safe method that returns a new instance of a DateTime object rounded
downwards to the nearest year.
|
static org.joda.time.DateTime |
now()
Get the current time as a DateTime.
|
static org.joda.time.DateTime |
parseEmbedded(String string0)
Parses a string for an embedded date and/or time contained within a
string such as "app.2008-05-01.log".
|
static org.joda.time.DateTime |
parseEmbedded(String string0,
String pattern,
org.joda.time.DateTimeZone zone)
Parses a string for an embedded date and/or time contained within a
string such as "app.2008-05-01.log" or "app-20090624-051112.log.gz".
|
static org.joda.time.DateTime |
toDateTime(Timestamp value)
Null-safe method of converting a SQL Timestamp into a DateTime that
it set specifically to be in UTC.
|
static Timestamp |
toTimestamp(org.joda.time.DateTime dt)
Null-safe method of converting a DateTime to a Timestamp.
|
public static org.joda.time.DateTime toDateTime(Timestamp value)
public static org.joda.time.DateTime copy(org.joda.time.DateTime value)
public static Timestamp toTimestamp(org.joda.time.DateTime dt)
public static org.joda.time.DateTime now()
public static org.joda.time.DateTime parseEmbedded(String string0) throws IllegalArgumentException
string0 - The string to parseIllegalArgumentException - Thrown if the string did not contain
an embedded date.public static org.joda.time.DateTime parseEmbedded(String string0, String pattern, org.joda.time.DateTimeZone zone) throws IllegalArgumentException
string0 - The string to parsepattern - The DateTime pattern embedded in the string such as
"yyyy-MM-dd". The pattern must be a valid DateTime Joda pattern.zone - The timezone the parsed date will be inIllegalArgumentException - Thrown if the pattern is invalid or if
string did not contain an embedded date.public static org.joda.time.DateTime floorToYear(org.joda.time.DateTime value)
value - The DateTime value to round downwardpublic static org.joda.time.DateTime floorToMonth(org.joda.time.DateTime value)
value - The DateTime value to round downwardpublic static org.joda.time.DateTime floorToDay(org.joda.time.DateTime value)
value - The DateTime value to round downwardpublic static org.joda.time.DateTime floorToHour(org.joda.time.DateTime value)
value - The DateTime value to round downwardpublic static org.joda.time.DateTime floorToHalfHour(org.joda.time.DateTime value)
value - The DateTime value to round downwardpublic static org.joda.time.DateTime floorToQuarterHour(org.joda.time.DateTime value)
value - The DateTime value to round downwardpublic static org.joda.time.DateTime floorToTenMinutes(org.joda.time.DateTime value)
value - The DateTime value to round downwardpublic static org.joda.time.DateTime floorToFiveMinutes(org.joda.time.DateTime value)
value - The DateTime value to round downwardpublic static org.joda.time.DateTime floorToMinutePeriod(org.joda.time.DateTime value,
int periodInMinutes)
value - The DateTime value to round downwardpublic static org.joda.time.DateTime floorToMinute(org.joda.time.DateTime value)
value - The DateTime value to round downwardpublic static org.joda.time.DateTime floorToSecond(org.joda.time.DateTime value)
value - The DateTime value to round downwardCopyright © 2012-2015 Cloudhopper by Twitter. All Rights Reserved.