public final class FormatUtil extends Object
null
) to represent an EPOCH format.Modifier and Type | Method and Description |
---|---|
static String |
formatDateString(String dateString,
String fromFormat,
Locale fromLocale,
String toFormat,
Locale toLocale,
String subjectName)
Formats a string representation of a date, into another string date
format.
|
static String |
formatDateString(String dateString,
String fromFormat,
String toFormat)
Formats a string representation of a date, into another string date
format.
|
static String |
formatDateString(String dateString,
String fromFormat,
String toFormat,
String fieldName)
Formats a string representation of a date, into another string date
format.
|
static ZonedDateTime |
parseZonedDateTimeString(String dateString,
String fromFormat,
Locale fromLocale,
String subjectName,
ZoneId zoneId)
Formats a string representation of a date, into another string date
format.
|
public static String formatDateString(String dateString, String fromFormat, String toFormat)
dateString
- the date to formatfromFormat
- source format (null
means EPOCH)toFormat
- target format (null
means EPOCH)null
if unable to formatpublic static String formatDateString(String dateString, String fromFormat, String toFormat, String fieldName)
dateString
- the date to formatfromFormat
- source formattoFormat
- target formatfieldName
- optional field name for referencing in error messagespublic static String formatDateString(String dateString, String fromFormat, Locale fromLocale, String toFormat, Locale toLocale, String subjectName)
dateString
- the date to formatfromFormat
- source formatfromLocale
- source format localetoFormat
- target formattoLocale
- target format localesubjectName
- optional subject name to appear in error messagespublic static ZonedDateTime parseZonedDateTimeString(String dateString, String fromFormat, Locale fromLocale, String subjectName, ZoneId zoneId)
dateString
- the date to formatfromFormat
- source formatfromLocale
- source format localesubjectName
- optional subject name to appear in error messageszoneId
- time zone id or null
to use system default
or detected one if specified in formatnull
if date string is
null
or could not parse.Copyright © 2009–2023 Norconex Inc.. All rights reserved.