|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.google.api.ads.dfp.axis.utils.v201203.DateTimes
public final class DateTimes
A utility class for handling DateTime objects.
| Method Summary | |
|---|---|
static Calendar |
toCalendar(DateTime dateTime)
Gets a calendar for a DateTime using the default locale,
i.e. |
static Calendar |
toCalendar(DateTime dateTime,
Locale locale)
Gets a calendar for a DateTime in the supplied locale. |
static DateTime |
toDateTime(Calendar calendar)
Converts a Calendar object to an API date time preserving the
time zone. |
static DateTime |
toDateTime(org.joda.time.DateTime dateTime)
Converts a DateTime object to an API date time preserving the
time zone. |
static org.joda.time.DateTime |
toDateTime(DateTime dateTime)
Converts an API date time to a DateTime preserving the time zone. |
static DateTime |
toDateTime(org.joda.time.Instant instant,
String timeZoneId)
Converts an Instant object to an API date time in the time zone
supplied. |
static DateTime |
toDateTime(String dateTime,
String timeZoneId)
Converts a string in the form of yyyy-MM-dd'T'HH:mm:ss to an API
date time in the time zone supplied. |
static String |
toString(DateTime dateTime)
Returns string representation of this date time. |
static String |
toStringWithZone(DateTime dateTime,
String newZoneId)
Returns string representation of this date time with a different time zone, preserving the millisecond instant. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static DateTime toDateTime(Calendar calendar)
Calendar object to an API date time preserving the
time zone.
public static DateTime toDateTime(org.joda.time.Instant instant,
String timeZoneId)
Instant object to an API date time in the time zone
supplied.
public static DateTime toDateTime(org.joda.time.DateTime dateTime)
DateTime object to an API date time preserving the
time zone.
public static DateTime toDateTime(String dateTime,
String timeZoneId)
yyyy-MM-dd'T'HH:mm:ss to an API
date time in the time zone supplied.
public static org.joda.time.DateTime toDateTime(DateTime dateTime)
DateTime preserving the time zone.
public static Calendar toCalendar(DateTime dateTime)
DateTime using the default locale,
i.e. Locale.getDefault().
public static Calendar toCalendar(DateTime dateTime,
Locale locale)
DateTime in the supplied locale.
public static String toString(DateTime dateTime)
toStringWithZone(DateTime, String) instead.
dateTime - the date time to stringify
DateTime in
yyyy-MM-dd'T'HH:mm:ss
public static String toStringWithZone(DateTime dateTime,
String newZoneId)
This method is useful for finding the local time in another time zone, especially for filtering.
For example, if this date time holds 12:30 in Europe/London, the result from this method with Europe/Paris would be 13:30. You may also want to use this with your network's time zone, i.e.
String timeZoneId = networkService.getCurrentNetwork().getTimeZone();
String statementPart =
"startDateTime > "
+ DateTimes.toString(apiDateTime, timeZoneId);
//...
statementBuilder.where(statementPart);
This method is in the same style of
DateTime.withZone(org.joda.time.DateTimeZone).
dateTime - the date time to stringify into a new time zonenewZoneId - the time zone ID of the new zone
DateTime in
yyyy-MM-dd'T'HH:mm:ss
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||