public class UtilsDate
extends java.lang.Object
Class that provides methods for managing dates.
Project:Library for the integration with the services of @Firma, eVisor and TS@.
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
FORMAT_DATE
Constant attribute that represents the date format
yyyy-MM-dd. |
static java.lang.String |
FORMAT_DATE_ADDITIONAL
Constant attribute that represents the date format
"yyyy/MM/dd EEE hh:mm:ss zzzz". |
static java.lang.String |
FORMAT_DATE_DOWN
Constant attribute that represents the date format
dd_MM_yyyy. |
static java.lang.String |
FORMAT_DATE_INVERTED
Constant attribute that represents the date format
"dd-MM-yyyy". |
static java.lang.String |
FORMAT_DATE_SLASH
Constant attribute that represents the date format
"dd/MM/yyyy/HH/mm/ss". |
static java.lang.String |
FORMAT_DATE_SMALL
Constant attribute that represents the date format
dd/MM/yyyy. |
static java.lang.String |
FORMAT_DATE_TIME
Constant attribute that represents the date format
yyyy-MM-dd HH:mm:ss. |
static java.lang.String |
FORMAT_DATE_TIME_ADDITIONAL
Constant attribute that represents the date format
"yyyy-MM-dd'T'HHmmssZ". |
static java.lang.String |
FORMAT_DATE_TIME_CRL_ISSUE_TIME
Constant attribute that represents the date format
"yyyy-MM-dd'T'HH:mm:ss". |
static java.lang.String |
FORMAT_DATE_TIME_FULL
Constant attribute that represents the date format
"yyyy-MM-dd HH:mm:ss,SSS". |
static java.lang.String |
FORMAT_DATE_TIME_JSON
Constant attribute that represents the date format
"yyyy-MM-dd'T'HH:mm:ss.SSSXXX". |
static java.lang.String |
FORMAT_DATE_TIME_JUNTA
Constant attribute that represents the date format
yyyyMMddHHmmss. |
static java.lang.String |
FORMAT_DATE_TIME_JUNTA_ADDITIONAL
Constant attribute that represents the date format
"yyyyMMddHHmmss.SZ". |
static java.lang.String |
FORMAT_DATE_TIME_MINUTES
Constant attribute that represents the date format
"dd-MMM-yyyy HH:mm". |
static java.lang.String |
FORMAT_DATE_TIME_MYSQL_HSQLDB
Constant attribute that represents the date format
"YYYY/MM/DD HH24:MI:SS". |
static java.lang.String |
FORMAT_DATE_TIME_NOTFULL
Constant attribute that represents the date format
"yyyy-MM-dd HH:mm:ss ZZZZ". |
static java.lang.String |
FORMAT_DATE_TIME_ORACLE
Constant attribute that represents the date format
"MM/DD/YYYY HH24:MI:SS". |
static java.lang.String |
FORMAT_DATE_TIME_SECONDS
Constant attribute that represents the date format
"dd-MM-yy_HH-mm-ss". |
static java.lang.String |
FORMAT_DATE_TIME_STANDARD
Constant attribute that represents the date format
"dd/MM/yyyy HH:mm:ss". |
static java.lang.String |
FORMAT_DATE_TIME_STANDARD_ADDITIONAL
Constant attribute that represents the date format
"dd/MM/yyyy HH:mm:ss.SSS". |
static java.lang.String |
FORMAT_DATE_TIME_TIMESTAMP
Constant attribute that represents the date format
"yyyy-MM-dd'T'HH:mm:ss'.' |
static java.lang.String |
FORMAT_DATE_TIME_UTC
Constant attribute that represents the date format
"yyyy-MM-dd'T'HH:mm:ss.SSS". |
static java.lang.String |
FORMAT_DATE_TIME_XML_CONFIGURATION
Constant attribute that represents the date format
"yyyy-MM-dd HH:mm:ss.SSS zzz". |
static java.lang.String |
FORMAT_FULL
Constant attribute that represents the date format
yyyy-MM-dd EEE HH:mm:ss ZZZZ. |
static java.lang.String |
FORMAT_TIME
Constant attribute that represents the date format
HH:mm:ss. |
| Constructor and Description |
|---|
UtilsDate()
Constructor method for the class UtilsDate.java.
|
UtilsDate(java.util.Calendar c)
Constructor method for the class UtilsDate.java.
|
UtilsDate(java.util.Date pFecha)
Constructor method for the class UtilsDate.java.
|
UtilsDate(java.lang.String timezone)
Constructor method for the class UtilsDate.java.
|
UtilsDate(java.lang.String dateString,
java.lang.String dateFormat)
Constructor method for the class UtilsDate.java.
|
UtilsDate(java.util.TimeZone t)
Constructor method for the class UtilsDate.java.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addDays(int numDays)
Method that adds a number of days to the date.
|
java.lang.String |
addDaysToSystemDate(int numDays)
Method that adds a number of days to the system date.
|
java.util.Date |
getDate()
Gets the value of the attribute
date. |
static java.util.Date |
getDateAddingDays(java.util.Date initialDate,
int numDays)
Method that adds a number of days to certain date.
|
static java.lang.Integer[] |
getHoursSecondsMinutes(java.lang.Long milliseconds)
Method that obtains the value in hours, minutes and seconds of a period in milliseconds.
|
static java.lang.Long |
getPeriod(java.lang.Long hourPeriod,
java.lang.Long minutePeriod,
java.lang.Long secondPeriod)
Method that obtains a period in milliseconds.
|
static java.lang.String |
getSystemDate(java.lang.String formato)
Method that obtains the current date and time of the system.
|
static java.lang.String |
getSystemDateAddingDays(java.lang.String initialDate,
int numDays)
Method that adds a number of days to certain date.
|
static java.util.Date |
getUTCDate(java.lang.String utcDate)
Method that obtains a date from a string with
UTC format. |
static java.lang.String |
modifyFormat(java.lang.String initialDate,
java.lang.String originalFormat,
java.lang.String newFormat)
Method that modifies the format of a date.
|
static java.util.Date |
parseToPDFDate(java.lang.String value)
Method that returns a Date from a string representing a PDF Date conform to the ASN.1 date format.
|
void |
setDate(java.util.Date pFecha)
Sets the value of the attribute
date. |
java.lang.String |
toString() |
java.lang.String |
toString(java.text.SimpleDateFormat simpleDateFormat)
Method that obtains a string with the value of the date for certain format.
|
java.lang.String |
toString(java.lang.String dateFormat)
Method that obtains a string with the value of the date for certain format.
|
static java.lang.String |
toString(java.lang.String dateFormat,
java.util.Date dateParam)
Method that obtains a string with the value of the date for certain format.
|
java.lang.String |
toUTCString()
Method that obtains a string which represents the date on
UTC format. |
static java.util.Date |
transformDate(java.lang.String initialDate,
java.lang.String pattern)
Method that obtains a date from a string using a determined pattern.
|
public static final java.lang.String FORMAT_FULL
yyyy-MM-dd EEE HH:mm:ss ZZZZ.public static final java.lang.String FORMAT_DATE
yyyy-MM-dd.public static final java.lang.String FORMAT_TIME
HH:mm:ss.public static final java.lang.String FORMAT_DATE_TIME
yyyy-MM-dd HH:mm:ss.public static final java.lang.String FORMAT_DATE_SMALL
dd/MM/yyyy.public static final java.lang.String FORMAT_DATE_DOWN
dd_MM_yyyy.public static final java.lang.String FORMAT_DATE_TIME_STANDARD
"dd/MM/yyyy HH:mm:ss".public static final java.lang.String FORMAT_DATE_SLASH
"dd/MM/yyyy/HH/mm/ss".public static final java.lang.String FORMAT_DATE_TIME_JUNTA
yyyyMMddHHmmss.public static final java.lang.String FORMAT_DATE_TIME_JUNTA_ADDITIONAL
"yyyyMMddHHmmss.SZ".public static final java.lang.String FORMAT_DATE_TIME_ADDITIONAL
"yyyy-MM-dd'T'HHmmssZ".public static final java.lang.String FORMAT_DATE_TIME_FULL
"yyyy-MM-dd HH:mm:ss,SSS".public static final java.lang.String FORMAT_DATE_INVERTED
"dd-MM-yyyy".public static final java.lang.String FORMAT_DATE_TIME_STANDARD_ADDITIONAL
"dd/MM/yyyy HH:mm:ss.SSS".public static final java.lang.String FORMAT_DATE_TIME_MINUTES
"dd-MMM-yyyy HH:mm".public static final java.lang.String FORMAT_DATE_TIME_NOTFULL
"yyyy-MM-dd HH:mm:ss ZZZZ".public static final java.lang.String FORMAT_DATE_TIME_UTC
"yyyy-MM-dd'T'HH:mm:ss.SSS".public static final java.lang.String FORMAT_DATE_ADDITIONAL
"yyyy/MM/dd EEE hh:mm:ss zzzz".public static final java.lang.String FORMAT_DATE_TIME_SECONDS
"dd-MM-yy_HH-mm-ss".public static final java.lang.String FORMAT_DATE_TIME_ORACLE
"MM/DD/YYYY HH24:MI:SS".public static final java.lang.String FORMAT_DATE_TIME_MYSQL_HSQLDB
"YYYY/MM/DD HH24:MI:SS".public static final java.lang.String FORMAT_DATE_TIME_XML_CONFIGURATION
"yyyy-MM-dd HH:mm:ss.SSS zzz".public static final java.lang.String FORMAT_DATE_TIME_CRL_ISSUE_TIME
"yyyy-MM-dd'T'HH:mm:ss".public static final java.lang.String FORMAT_DATE_TIME_TIMESTAMP
"yyyy-MM-dd'T'HH:mm:ss'.'SSS'Z'".public static final java.lang.String FORMAT_DATE_TIME_JSON
"yyyy-MM-dd'T'HH:mm:ss.SSSXXX".public UtilsDate()
public UtilsDate(java.util.Date pFecha)
pFecha - Parameter that represents the value of the date.public UtilsDate(java.util.Calendar c)
c - Parameter that represents the object to set the value of the date and the time zone offset.public UtilsDate(java.util.TimeZone t)
t - Parameter that represents the time zone offset.public UtilsDate(java.lang.String timezone)
timezone - Parameter that represents the identifier for the time zone offset.public UtilsDate(java.lang.String dateString,
java.lang.String dateFormat)
throws java.text.ParseException
dateString - Parameter that represents the value of the date.dateFormat - Parameter that represents the format used for the date.java.text.ParseException - If the method fails.public final java.lang.String toString(java.lang.String dateFormat)
dateFormat - Parameter that represents the format to apply for the date.public static final java.lang.String toString(java.lang.String dateFormat,
java.util.Date dateParam)
dateFormat - Parameter that represents the format to apply for the date.dateParam - Date to be transform to Stringpublic final java.lang.String toString(java.text.SimpleDateFormat simpleDateFormat)
simpleDateFormat - Parameter that represents the concrete object for formatting and parsing the date in a locale-sensitive manner.public final java.lang.String toUTCString()
UTC format.UTC format.public static java.util.Date getUTCDate(java.lang.String utcDate)
throws java.text.ParseException
UTC format.utcDate - Parameter that represents the string with UTC format.java.text.ParseException - If the method fails.public static java.lang.String getSystemDate(java.lang.String formato)
formato - Parameter that represents the format used to obtain the date.public final java.lang.String toString()
toString in class java.lang.ObjectObject.toString()public final java.util.Date getDate()
date.date.public final void setDate(java.util.Date pFecha)
date.pFecha - The value for the attribute date.public final void addDays(int numDays)
numDays - Parameter that represents the number of days to add.public static java.lang.String modifyFormat(java.lang.String initialDate,
java.lang.String originalFormat,
java.lang.String newFormat)
throws java.text.ParseException
initialDate - Parameter that represents the date.originalFormat - Parameter that represents the original format.newFormat - Parameter that represents the new format.java.text.ParseException - If the method fails.public final java.lang.String addDaysToSystemDate(int numDays)
throws java.text.ParseException
numDays - Parameter that represents the number of days to add.yyyy-mm-dd.java.text.ParseException - If the method fails.public static java.lang.String getSystemDateAddingDays(java.lang.String initialDate,
int numDays)
throws java.text.ParseException
initialDate - Parameter that represents the date to add the days. It's a string with YYYYMMDD format.numDays - Parameter that represents the number of days to add.yyyyMMDD.java.text.ParseException - If the method fails.public static java.util.Date getDateAddingDays(java.util.Date initialDate,
int numDays)
initialDate - Parameter that represents the date to add the days.numDays - Parameter that represents the number of days to add.public static java.util.Date transformDate(java.lang.String initialDate,
java.lang.String pattern)
throws java.text.ParseException
initialDate - Parameter that represents the string to transform in date.pattern - Parameter that represents the pattern used to generate the date.java.text.ParseException - If the method fails.public static java.util.Date parseToPDFDate(java.lang.String value)
value - Parameter that represents the PDF Date.public static java.lang.Long getPeriod(java.lang.Long hourPeriod,
java.lang.Long minutePeriod,
java.lang.Long secondPeriod)
hourPeriod - Parameter that represents the hour.minutePeriod - Parameter that represents the minutes.secondPeriod - Parameter that represents the seconds.null if some of the values.public static java.lang.Integer[] getHoursSecondsMinutes(java.lang.Long milliseconds)
milliseconds - Parameter that represents the period in milliseconds.