public class DateFormatCode extends CodeValidation
| Modifier and Type | Field and Description |
|---|---|
static String |
YYYYMM
The Constant YYYYMM.
|
static String |
YYYYMMDD
The Constant YYYYMMDD.
|
static String |
YYYYWW
The Constant YYYYWW.
|
| Constructor and Description |
|---|
DateFormatCode() |
| Modifier and Type | Method and Description |
|---|---|
Date |
convertToDate(String d,
String format)
Converts a string to a date in a specific format.
|
String |
convertToString(Date d,
String format)
Converts a date to a string.
|
static SimpleDateFormat |
getDateFormat(String format)
Gets the date format.
|
boolean |
isValid(String format)
Checks if a specific code is valid.
|
check, isLowercase, isNumeric, isUppercasepublic static final String YYYYMMDD
public static final String YYYYMM
public static final String YYYYWW
public static SimpleDateFormat getDateFormat(String format) throws InvalidCodeException
format - the formatInvalidCodeException - the invalid code exceptionpublic boolean isValid(String format)
CodeValidationisValid in class CodeValidationformat - the value you want to checkpublic String convertToString(Date d, String format) throws InvalidCodeException
d - the dateformat - the formatInvalidCodeException - the invalid code exceptionpublic Date convertToDate(String d, String format) throws InvalidCodeException, ParseException
d - the dateformat - the formatInvalidCodeException - the invalid code exceptionParseException - the parse exceptionCopyright © 1998–2018 iText Group NV. All rights reserved.