DateUtil (Google App Engine API for Java)

com.google.appengine.api.search

Class DateUtil

  • java.lang.Object
    • com.google.appengine.api.search.DateUtil


  • public final class DateUtil
    extends java.lang.Object
    A utility class that centralizes processing of dates.
    • Field Summary

      Fields 
      Modifier and Type Field and Description
      static int MILLISECONDS_IN_DAY
      The milliseconds in a day.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method and Description
      static java.util.Date deserializeDate(java.lang.String date)
      Converts a string containing the milliseconds since the UNIX Epoch into a Date.
      static java.lang.String formatDateTime(java.util.Date date)
      Formats a date according ISO 8601 full date time format.
      static java.util.Date getEpochPlusDays(int days, int milliseconds)
      Constructs a Date set to the UNIX Epoch plus days plus milliseconds.
      static java.lang.String serializeDate(java.util.Date date)
      Converts date into a string containing the milliseconds since the UNIX Epoch.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • MILLISECONDS_IN_DAY

        public static final int MILLISECONDS_IN_DAY
        The milliseconds in a day.
        See Also:
        Constant Field Values
    • Method Detail

      • formatDateTime

        public static java.lang.String formatDateTime(java.util.Date date)
        Formats a date according ISO 8601 full date time format. Currently, this is used to print dates for error messages.
        Parameters:
        date - the date to format as a string
        Returns:
        a string representing the date in ISO 8601 format
      • serializeDate

        public static java.lang.String serializeDate(java.util.Date date)
        Converts date into a string containing the milliseconds since the UNIX Epoch.
        Parameters:
        date - the date to serialize as a string
        Returns:
        a string representing the date as milliseconds since the UNIX Epoch
      • deserializeDate

        public static java.util.Date deserializeDate(java.lang.String date)
        Converts a string containing the milliseconds since the UNIX Epoch into a Date. Two formats of date string are supported: "yyyy-MM-dd" and a long. Eventually, the "yyyy-MM-dd" format support will be removed.
        Parameters:
        date - the date string to deserialize into a date
        Returns:
        a date
      • getEpochPlusDays

        public static final java.util.Date getEpochPlusDays(int days,
                                                            int milliseconds)
        Constructs a Date set to the UNIX Epoch plus days plus milliseconds.
        Parameters:
        days - the number of days to add to the UNIX Epoch to get a Date
        milliseconds - the number of milliseconds to add to the date
        Returns:
        the Date with number of days plus Epoch

Send feedback about...

App Engine standard environment for Java