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
-
Method Summary
Modifier and TypeMethodDescriptionstatic String
formatDate
(Date date, String format) Creates a string with the specified date formatting.static String
formatDate
(Date date, String format, TimeZone zone) Creates a string with the specified date formatting.static String
formatDate
(Date date, String format, EarthLocation loc) Creates a string with the specified date formatting.static Date
Creates 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 JavaSimpleDateFormat
class.- 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 JavaSimpleDateFormat
class.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 JavaSimpleDateFormat
class.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 JavaSimpleDateFormat
class.- Returns:
- a date object or null if the input string cannot be parsed.
- Throws:
ParseException
-