public class DateUtils extends Object
Modifier and Type | Field and Description |
---|---|
static String |
FORMAT_DATE |
static String |
FORMAT_FULL_GENERIC |
static String |
FORMAT_GENERICDATETIME |
static String |
FORMAT_MILLISECONDS |
static String |
FORMAT_TIME_HMS |
static String |
fullIsoFormat |
protected static org.apache.logging.log4j.Logger |
log |
static String |
shortIsoFormat |
Constructor and Description |
---|
DateUtils() |
Modifier and Type | Method and Description |
---|---|
static String |
changeDate(String date,
int years,
int months,
int days)
Add a number of years, months, days to a date specified in a shortIsoFormat, and return it in the same format.
|
static String |
changeDate(String date,
int years,
int months,
int days,
String dateFormat)
Add a number of years, months, days to a date specified in a certain format, and return it in the same format.
|
static String |
convertDate(String from,
String to,
String value)
Convert date format
|
static String |
format(Date date) |
static String |
format(Date date,
String dateFormat) |
static String |
format(long date) |
static String |
format(long date,
String dateFormat) |
static String |
getIsoTimeStamp()
Get current date-time timestamp in ISO 8601 format.
|
static String |
getTimeStamp()
Get current date-time timestamp in generic format.
|
static boolean |
isSameDay(Date date1,
Date date2) |
static Date |
parseAnyDate(String dateInAnyFormat)
Parses a string to a Date using CalendarParser
|
static Date |
parseToDate(String s,
String dateFormat)
Parses a string to a Date, according to the pattern
|
static Date |
parseXmlDateTime(String s)
Parses a string to a Date using XML Schema dateTime data type (GDate)
|
protected static org.apache.logging.log4j.Logger log
public static final String fullIsoFormat
public static final String shortIsoFormat
public static final String FORMAT_FULL_GENERIC
public static final String FORMAT_MILLISECONDS
public static final String FORMAT_GENERICDATETIME
public static final String FORMAT_DATE
public static final String FORMAT_TIME_HMS
public static String format(long date)
public static String getIsoTimeStamp()
public static String getTimeStamp()
public static Date parseToDate(String s, String dateFormat)
public static Date parseXmlDateTime(String s)
public static Date parseAnyDate(String dateInAnyFormat) throws CalendarParserException
CalendarParserException
public static String convertDate(String from, String to, String value) throws ParseException
from
- String date format from.to
- String date format to.value
- String date to reformat.ParseException
public static String changeDate(String date, int years, int months, int days) throws ParseException
date
- A String representing a date in format yyyy-MM-dd.years
- months
- days
- ParseException
public static String changeDate(String date, int years, int months, int days, String dateFormat) throws ParseException
date
- A String representing a date in format (dateFormat).years
- intmonths
- intdays
- intdateFormat
- A String representing the date format of date.ParseException
Copyright © 2023 Frank!Framework. All rights reserved.