public class DateFormatter
extends java.lang.Object
DateFormatter
class contains a number of static
methods to format dates easily based on timezone and Earth
location.Constructor and Description |
---|
DateFormatter() |
Modifier and Type | Method and Description |
---|---|
static java.lang.String |
formatDate(java.util.Date date,
java.lang.String format)
Creates a string with the specified date formatting.
|
static java.lang.String |
formatDate(java.util.Date date,
java.lang.String format,
EarthLocation loc)
Creates a string with the specified date formatting.
|
static java.lang.String |
formatDate(java.util.Date date,
java.lang.String format,
java.util.TimeZone zone)
Creates a string with the specified date formatting.
|
static java.util.Date |
parseDate(java.lang.String input,
java.lang.String format)
Creates a date from the specified string and format.
|
public static java.lang.String formatDate(java.util.Date date, java.lang.String format)
date
- the date to format.format
- a format string in the style of the Java
SimpleDateFormat
class.public static java.lang.String formatDate(java.util.Date date, java.lang.String format, java.util.TimeZone zone)
date
- the date to format.format
- a format string in the style of the Java
SimpleDateFormat
class.zone
- the time zone for formatting.public static java.lang.String formatDate(java.util.Date date, java.lang.String format, EarthLocation loc)
date
- the date to format.format
- a format string in the style of the Java
SimpleDateFormat
class.loc
- the earth location used to determine the appropriate
time zone.public static java.util.Date parseDate(java.lang.String input, java.lang.String format) throws java.text.ParseException
input
- the input string to parse.format
- a format string in the style of the Java
SimpleDateFormat
class.java.text.ParseException