public class DateTimeFormatter
extends java.lang.Object
Constructor and Description |
---|
DateTimeFormatter() |
Modifier and Type | Method and Description |
---|---|
static java.util.Date |
getDate(java.lang.String date)
Converts a string in the yyyy.MM.dd format to a date object.
|
static java.util.Date |
getDate(java.lang.String date,
java.lang.String time)
Combines string in the yyyy.MM.dd and HH:mm:ss format and converts
the combination to a date object.
|
static java.lang.String |
getFormattedDate(java.util.Date date,
boolean useGMT)
Formats the date part only.
|
static java.lang.String |
getFormattedDateTime(java.util.Date date,
boolean useGMT)
Formats the date and time parts.
|
static java.lang.String |
getFormattedTime(java.util.Date date,
boolean useGMT)
Formats the time part only.
|
static java.lang.String |
getPrintableDate(java.lang.String date)
Converts a date in the yyyy.MM.dd format to a format suitable to
display.
|
static java.text.DateFormat |
getPrintableDateFormat() |
static java.lang.String |
getPrintableDateTime(java.util.Date date)
Converts the date to a format suitable to display.
|
static java.util.Date |
parseDateTime(java.lang.String dateTime)
Converts a string in the yyyy.MM.dd HH:mm:ss format to a date object.
|
static void |
setPrintableDateFormat(java.text.DateFormat dateFormat)
Sets the date and time formater which should be used to format date
and time in order to display it.
|
static void |
timeZoneChanged()
Reinitialises various date and time formaters with the new time
zone.
|
public static void timeZoneChanged()
public static java.text.DateFormat getPrintableDateFormat()
public static void setPrintableDateFormat(java.text.DateFormat dateFormat)
dateFormat
- An instance of a date and time formater.public static java.lang.String getPrintableDate(java.lang.String date)
date
- The date to format.public static java.lang.String getPrintableDateTime(java.util.Date date)
date
- The date to format.public static java.lang.String getFormattedDate(java.util.Date date, boolean useGMT)
date
- The date to format.useGMT
- Set this flag to true
to use the GMT formater.public static java.lang.String getFormattedTime(java.util.Date date, boolean useGMT)
date
- The date to format.useGMT
- Set this flag to true
to use the GMT formater.public static java.lang.String getFormattedDateTime(java.util.Date date, boolean useGMT)
date
- The date to format.useGMT
- Set this flag to true
to use the GMT formater.public static java.util.Date getDate(java.lang.String date)
date
- A string in the yyyy.MM.dd format.null
if the date can not be extracted
from the string.public static java.util.Date getDate(java.lang.String date, java.lang.String time)
date
- A string in the yyyy.MM.dd format.time
- A string in the HH:mm:ss format.null
if the date can not be extracted
from the string.public static java.util.Date parseDateTime(java.lang.String dateTime)
dateTime
- A string in the yyyy.MM.dd HH:mm:ss format.null
if the date can not be extracted
from the string.Copyright ©, 2005-2019 Prolancer Pty Ltd, Sydney Australia.