Package noaa.coastwatch.util
Class DateFormatter
java.lang.Object
noaa.coastwatch.util.DateFormatter
The
DateFormatter class contains a number of static
methods to format dates easily based on timezone and Earth
location.- Since:
- 3.1.8
- Author:
- Peter Hollemans
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic StringformatDate(Date date, String format) Creates a string with the specified date formatting.static StringformatDate(Date date, String format, TimeZone zone) Creates a string with the specified date formatting.static StringformatDate(Date date, String format, EarthLocation loc) Creates a string with the specified date formatting.static DateCreates a date from the specified string and format.
-
Constructor Details
-
DateFormatter
public DateFormatter()
-
-
Method Details
-
formatDate
Creates a string with the specified date formatting. The date is formatted as if it was in the GMT+0 timezone.- Parameters:
date- the date to format.format- a format string in the style of the JavaSimpleDateFormatclass.- Returns:
- a string with the date formatted.
-
formatDate
Creates a string with the specified date formatting. The date is formatted as if it was in the specified time zone.- Parameters:
date- the date to format.format- a format string in the style of the JavaSimpleDateFormatclass.zone- the time zone for formatting.- Returns:
- a string with the date formatted.
-
formatDate
Creates a string with the specified date formatting. The date is formatted as if it was in the time zone specified by the Earth location longitude.- Parameters:
date- the date to format.format- a format string in the style of the JavaSimpleDateFormatclass.loc- the earth location used to determine the appropriate time zone.- Returns:
- a string with the date formatted.
-
parseDate
Creates a date from the specified string and format.- Parameters:
input- the input string to parse.format- a format string in the style of the JavaSimpleDateFormatclass.- Returns:
- a date object or null if the input string cannot be parsed.
- Throws:
ParseException
-