## com.baidubce.util
Class DateUtils

    java.lang.Object
      com.baidubce.util.DateUtils

    public class DateUtils

extends Object

Utilities for parsing and formatting dates.

Note that this class doesn't use static methods because of the synchronization issues with SimpleDateFormat. This lets synchronization be done on a per-object level, instead of on a per-class level.

Constructor Summary
`DateUtils()`

Method Summary
`static String` `formatAlternateIso8601Date(Date date)` Formats the specified date as an ISO 8601 string.
`static String` `formatIso8601Date(Date date)` Formats the specified date as an ISO 8601 string.
`static String` `formatRfc822Date(Date date)` Formats the specified date as an RFC 822 string.
`static Date` `parseAlternateIso8601Date(String dateString)` Parses the specified date string as an ISO 8601 date and returns the Date object.
`static Date` `parseCompressedIso8601Date(String dateString)` Parses the specified date string as a compressedIso8601DateFormat ("yyyyMMdd'T'HHmmss'Z'") and returns the Date object.
`static Date` `parseIso8601Date(String dateString)` Parses the specified date string as an ISO 8601 date and returns the Date object.
`static Date` `parseRfc822Date(String dateString)` Parses the specified date string as an RFC 822 date and returns the Date object.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### DateUtils

    public DateUtils()

Method Detail

### parseIso8601Date

    public static Date parseIso8601Date(String dateString)

  Parses the specified date string as an ISO 8601 date and returns the Date object.

  Parameters:
    `dateString` - The date string to parse.
  Returns:
    The parsed Date object.
  Throws:
    `IllegalArgumentException` - If the date string could not be parsed.

### formatIso8601Date

    public static String formatIso8601Date(Date date)

  Formats the specified date as an ISO 8601 string.

  Parameters:
    `date` - The date to format.
  Returns:
    The ISO 8601 string representing the specified date.

### parseAlternateIso8601Date

    public static Date parseAlternateIso8601Date(String dateString)

  Parses the specified date string as an ISO 8601 date and returns the Date object.

  Parameters:
    `dateString` - The date string to parse.
  Returns:
    The parsed Date object.
  Throws:
    `IllegalArgumentException` - If the date string could not be parsed.

### formatAlternateIso8601Date

    public static String formatAlternateIso8601Date(Date date)

  Formats the specified date as an ISO 8601 string.

  Parameters:
    `date` - The date to format.
  Returns:
    The ISO 8601 string representing the specified date.

### parseRfc822Date

    public static Date parseRfc822Date(String dateString)

  Parses the specified date string as an RFC 822 date and returns the Date object.

  Parameters:
    `dateString` - The date string to parse.
  Returns:
    The parsed Date object.
  Throws:
    `IllegalArgumentException` - If the date string could not be parsed.

### formatRfc822Date

    public static String formatRfc822Date(Date date)

  Formats the specified date as an RFC 822 string.

  Parameters:
    `date` - The date to format.
  Returns:
    The RFC 822 string representing the specified date.

### parseCompressedIso8601Date

    public static Date parseCompressedIso8601Date(String dateString)

  Parses the specified date string as a compressedIso8601DateFormat ("yyyyMMdd'T'HHmmss'Z'") and returns the Date object.

  Parameters:
    `dateString` - The date string to parse.
  Returns:
    The parsed Date object.
  Throws:
    `IllegalArgumentException` - If the date string could not be parsed.

Copyright © 2016. All rights reserved.