net.rim.pushsdk.commons
Class DateUtil

java.lang.Object
  extended by net.rim.pushsdk.commons.DateUtil

public class DateUtil
extends Object

Utility class providing methods for date manipulation such as formatting dates to strings and vice versa.

Author:
mdicesare

Field Summary
static String DATE_FORMAT_NO_MILLIS
          Date format without a milliseconds component.
static TimeZone defaultTZ
          The default time zone (UTC).
static String PAP_DATE_FORMAT
          The format of dates for PAP.
 
Constructor Summary
DateUtil()
           
 
Method Summary
static String formatDate(String format, Date date)
          Generic date formatter.
static String formatDate(String format, Date date, TimeZone zone)
          Generic date formatter.
static String formatPapDate(Date date)
          Formats a date in PAP date format.
static Date parsePapDate(String strDate)
          Parses out a date from a string in PAP date format.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

defaultTZ

public static final TimeZone defaultTZ
The default time zone (UTC).


PAP_DATE_FORMAT

public static final String PAP_DATE_FORMAT
The format of dates for PAP.

See Also:
Constant Field Values

DATE_FORMAT_NO_MILLIS

public static final String DATE_FORMAT_NO_MILLIS
Date format without a milliseconds component.

See Also:
Constant Field Values
Constructor Detail

DateUtil

public DateUtil()
Method Detail

parsePapDate

public static Date parsePapDate(String strDate)
                         throws ParseException
Parses out a date from a string in PAP date format. The default timezone is used.

Parameters:
strDate - a string in PAP date format
Returns:
a parsed out date
Throws:
ParseException - if the string could not be parsed

formatPapDate

public static String formatPapDate(Date date)
Formats a date in PAP date format. The default timezone is used.

Parameters:
date - the date to be formatted
Returns:
a string in PAP date format

formatDate

public static String formatDate(String format,
                                Date date)
Generic date formatter. The default timezone is used.

Parameters:
format - the date format to be used
date - the date to be formatted
Returns:
a string representing a date in the given format

formatDate

public static String formatDate(String format,
                                Date date,
                                TimeZone zone)
Generic date formatter. The default timezone is used.

Parameters:
format - the date format to be used
date - the date to be formatted
Returns:
a string representing a date in the given format


Copyright © 2011 Research In Motion. All Rights Reserved.