net.sourceforge.rssowl.util
Class DateParser

java.lang.Object
  extended bynet.sourceforge.rssowl.util.DateParser

public final class DateParser
extends Object

Utility class providing convenience methods to (XML) parsing mechanisms.

Version:
1.1.3
Author:
Niko Schmuck (niko@nava.de) and Benjamin Pasero (bpasero@rssowl.org)

Field Summary
private static DateFormat DATE_FORMAT
          Formatter for Date based on OS Locale
private static DateFormat DATE_LONG_FORMAT
          Formatter for Date (long) based on OS Locale
private static DateFormat DATE_TIME_FORMAT
          Formatter for Date and Time based on OS Locale
private static DateFormat DATE_TIME_LONG_FORMAT
          Formatter for Date and Time (long) based on OS Locale
private static SimpleDateFormat[] dateFormats
          An array of common date formats
 
Constructor Summary
private DateParser()
          This utility class constructor is hidden
 
Method Summary
static String dateToFileName(String date)
          Remove special chars of a date to use it into a filename
static String formatDate()
          Format the current date to a String using the selected Locale and do not add the time to the String
static String formatDate(boolean withTime)
          Format the current date to a String using the selected Locale.
static String formatDate(Date date, boolean withTime)
          Format the date to a String using the selected Locale.
static String formatDate(Date date, boolean longDateFormat, boolean withTime)
          Format the date to a String using the selected Locale.
static String formatLongDate(Date aDate)
          Get the localized long date format for the given language.
static Date getDate(String strdate)
          Tries different date formats to parse against the given string representation to retrieve a valid Date object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DATE_FORMAT

private static final DateFormat DATE_FORMAT
Formatter for Date based on OS Locale


DATE_LONG_FORMAT

private static final DateFormat DATE_LONG_FORMAT
Formatter for Date (long) based on OS Locale


DATE_TIME_FORMAT

private static final DateFormat DATE_TIME_FORMAT
Formatter for Date and Time based on OS Locale


DATE_TIME_LONG_FORMAT

private static final DateFormat DATE_TIME_LONG_FORMAT
Formatter for Date and Time (long) based on OS Locale


dateFormats

private static SimpleDateFormat[] dateFormats
An array of common date formats

Constructor Detail

DateParser

private DateParser()
This utility class constructor is hidden

Method Detail

dateToFileName

public static String dateToFileName(String date)
Remove special chars of a date to use it into a filename

Parameters:
date - The date as String
Returns:
String The given date with replaced special chars

formatDate

public static String formatDate()
Format the current date to a String using the selected Locale and do not add the time to the String

Returns:
String Formatted Date

formatDate

public static String formatDate(boolean withTime)
Format the current date to a String using the selected Locale.

Parameters:
withTime - If TRUE set time to date String
Returns:
String Formatted Date

formatDate

public static String formatDate(Date date,
                                boolean withTime)
Format the date to a String using the selected Locale.

Parameters:
date - The date to format
withTime - If TRUE set time to date String
Returns:
String Formatted Date

formatDate

public static String formatDate(Date date,
                                boolean longDateFormat,
                                boolean withTime)
Format the date to a String using the selected Locale.

Parameters:
date - The date to format
longDateFormat - If TRUE use the Long Date Format
withTime - If TRUE set time to date String
Returns:
String Formatted Date

formatLongDate

public static String formatLongDate(Date aDate)
Get the localized long date format for the given language.

Parameters:
aDate - The date to format
Returns:
String The date format

getDate

public static Date getDate(String strdate)
Tries different date formats to parse against the given string representation to retrieve a valid Date object.

Parameters:
strdate - Date as String
Returns:
Date The parsed Date


RSSOwl - RSS / RDF / Atom Newsreader

SourceForge.net Logo