org.codeforamerica.open311.internals.parsing
Class DateParser

java.lang.Object
  extended by org.codeforamerica.open311.internals.parsing.DateParser

public class DateParser
extends Object

Provides operations to handle dates. Check the GeoReport wiki for more information.

Author:
Santiago MunĂ­n

Constructor Summary
DateParser()
           
 
Method Summary
 Date parseDate(String rawDate)
          Parses a string representing a date.
 String printDate(Date date)
          Prints a date.
 DateParser withTimezone(org.joda.time.DateTimeZone timeZone)
          Sets the timezone of the system.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DateParser

public DateParser()
Method Detail

withTimezone

public DateParser withTimezone(org.joda.time.DateTimeZone timeZone)
Sets the timezone of the system.

Parameters:
timeZone - A valid timezone.

parseDate

public Date parseDate(String rawDate)
Parses a string representing a date.

Parameters:
rawDate - ISO 8601 is the preferred format. Check dateFormats to check all the accepted formats.
Returns:
A date object.

printDate

public String printDate(Date date)
Prints a date. ISO 8601 is the preferred format. Check dateFormats to check all the accepted formats.

Parameters:
date - Date to print.
Returns:
ISO 8601 format date if possible (else, the first valid) or null if it didn't match any format.


Copyright © 2013 Code for America. All Rights Reserved.