public class DateFormatting extends java.lang.Object implements Formatting
Constructor and Description |
---|
DateFormatting() |
Modifier and Type | Method and Description |
---|---|
java.lang.String |
formatDate(java.lang.Object obj,
java.lang.String pattern,
java.util.Locale locale)
Get the formatted string of default time zone in specified pattern and specified Locale.
|
java.lang.String |
formatDate(java.lang.Object obj,
java.lang.String pattern,
java.lang.String timeZone,
java.util.Locale locale)
Get the formatted string of specified time zone in specified pattern and specified Locale.
|
java.lang.String |
formatDate(java.lang.Object obj,
java.lang.String pattern,
java.lang.String timeZone,
java.lang.String language,
java.lang.String region) |
public java.lang.String formatDate(java.lang.Object obj, java.lang.String pattern, java.util.Locale locale)
obj
- The object which represents date, it can be Date, Calendar, timestamp in long, or ISO string.
For ISO string, please refer to https://www.w3.org/TR/NOTE-datetime.pattern
- The format you want the date string show in. Currently VIP supports 12 formats, they are
full, long, medium, short, fullDate, longDate, mediumDate, shortDate, fullTime, longTime,
mediumTime, shortTime.
The first four formats combine date and time together. For the real pattern each format
representslocale
- The locale for which the date format is desired.public java.lang.String formatDate(java.lang.Object obj, java.lang.String pattern, java.lang.String timeZone, java.util.Locale locale)
obj
- The object which represents date, it can be Date, Calendar, timestamp in long, or ISO
string. For ISO string, please refer to https://www.w3.org/TR/NOTE-datetime.pattern
- The format you want the date string show in. Currently VIP supports 12 formats, they are
full, long, medium, short, fullDate, longDate, mediumDate, shortDate, fullTime, longTime,
mediumTime, shortTime.
The first four formats combine date and time together. For the real pattern each format
representstimeZone
- The ID for a TimeZone, such as "America/Los_Angeles", or a custom ID such as "GMT-8:00".locale
- The locale for which the date format is desired.public java.lang.String formatDate(java.lang.Object obj, java.lang.String pattern, java.lang.String timeZone, java.lang.String language, java.lang.String region)