ezvcard.util
Class VCardDateFormatter

java.lang.Object
  extended by ezvcard.util.VCardDateFormatter

public class VCardDateFormatter
extends Object

Helper class that formats and parses vCard dates. vCard dates adhere to the ISO8601 date format standard.

Author:
Michael Angstadt

Method Summary
static String format(Date date, ISOFormat format)
          Formats a date for inclusion in a vCard.
static String format(Date date, ISOFormat format, TimeZone timeZone)
          Formats a date for inclusion in a vCard.
static Date parse(String dateStr)
          Parses a vCard date.
static TimeZone parseTimeZoneId(String timezoneId)
          Gets the TimeZone object that corresponds to the given ID.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

format

public static String format(Date date,
                            ISOFormat format)
Formats a date for inclusion in a vCard.

Parameters:
date - the date to format
format - the format to use
Returns:
the formatted date

format

public static String format(Date date,
                            ISOFormat format,
                            TimeZone timeZone)
Formats a date for inclusion in a vCard.

Parameters:
date - the date to format
format - the format to use
timeZone - the time zone to format the date in. This will be ignored if the specified ISOFormat is a "UTC" format
Returns:
the formatted date

parse

public static Date parse(String dateStr)
Parses a vCard date.

Parameters:
dateStr - the date string to parse
Returns:
the parsed date
Throws:
IllegalArgumentException - if the date string isn't in one of the accepted ISO8601 formats

parseTimeZoneId

public static TimeZone parseTimeZoneId(String timezoneId)
Gets the TimeZone object that corresponds to the given ID.

Parameters:
timezoneId - the timezone ID (e.g. "America/New_York")
Returns:
the timezone object or null if not found


Copyright © 2012-2014 Michael Angstadt. All Rights Reserved.