org.littleshoot.util
Class DateUtils

java.lang.Object
  extended by org.littleshoot.util.DateUtils

public class DateUtils
extends Object

Date utility functions.


Constructor Summary
DateUtils()
           
 
Method Summary
static String createHttpDate()
          Generate an RFC 822 date for use in the Date HTTP header.
static String iso8601()
          Encodes date value into ISO8601 that can be compared lexicographically.
static String iso8601(Date date)
           
static Date iso8601ToDate(String dateString)
          Converts the specified string in ISO 8601 format to a Date instance.
static Date parseHttpDate(String httpDateString)
          Utility method for parsing an HTTP Date header.
static String prettyS3Date(String dateString)
           
 
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

prettyS3Date

public static String prettyS3Date(String dateString)

parseHttpDate

public static Date parseHttpDate(String httpDateString)
                          throws org.apache.commons.httpclient.util.DateParseException
Utility method for parsing an HTTP Date header. This should match the following date pattern: EEE, d MMM yyyy HH:mm:ss Z

Parameters:
httpDateString - The date string to parse.
Returns:
The Date instance.
Throws:
org.apache.commons.httpclient.util.DateParseException - If the date is not in the expected format.

createHttpDate

public static String createHttpDate()
Generate an RFC 822 date for use in the Date HTTP header.

Returns:
The HTTP Date string.

iso8601

public static String iso8601()
Encodes date value into ISO8601 that can be compared lexicographically.

Returns:
string representation of the date value for the current date.

iso8601

public static String iso8601(Date date)

iso8601ToDate

public static Date iso8601ToDate(String dateString)
                          throws ParseException
Converts the specified string in ISO 8601 format to a Date instance.

Parameters:
dateString - The string to convert.
Returns:
The Date instance.
Throws:
ParseException - If the date could not be parsed.


Copyright © 2011-2013 LittleShoot. All Rights Reserved.