public class UtilsTime
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 |
FORMATO_COMPLETO
Constant attribute that represents the date format
yyyy-MM-dd EEE HH:mm:ss ZZZZ. |
static java.lang.String |
FORMATO_COMPLETO_ADICIONAL
Constant attribute that represents the date format
"yyyy/MM/dd EEE hh:mm:ss zzzz". |
static java.lang.String |
FORMATO_FECHA
Constant attribute that represents the date format
yyyy-MM-dd. |
static java.lang.String |
FORMATO_FECHA_BAJA
Constant attribute that represents the date format
dd_MM_yyyy. |
static java.lang.String |
FORMATO_FECHA_BARRAS
Constant attribute that represents the date format
"dd/MM/yyyy/HH/mm/ss". |
static java.lang.String |
FORMATO_FECHA_CORTO
Constant attribute that represents the date format
dd/MM/yyyy. |
static java.lang.String |
FORMATO_FECHA_ESTANDAR
Constant attribute that represents the date format
"dd/MM/yyyy HH:mm:ss". |
static java.lang.String |
FORMATO_FECHA_ESTANDAR_ADICIONAL
Constant attribute that represents the date format
"dd/MM/yyyy HH:mm:ss.SSS". |
static java.lang.String |
FORMATO_FECHA_HORA
Constant attribute that represents the date format
yyyy-MM-dd HH:mm:ss. |
static java.lang.String |
FORMATO_FECHA_HORA_ADICIONAL
Constant attribute that represents the date format
"yyyy-MM-dd'T'HHmmssZ". |
static java.lang.String |
FORMATO_FECHA_HORA_COMPLETA
Constant attribute that represents the date format
"yyyy-MM-dd HH:mm:ss,SSS". |
static java.lang.String |
FORMATO_FECHA_HORA_MINUTOS
Constant attribute that represents the date format
"dd-MMM-yyyy HH:mm". |
static java.lang.String |
FORMATO_FECHA_HORA_SEGUNDOS
Constant attribute that represents the date format
"dd-MM-yy_HH-mm-ss". |
static java.lang.String |
FORMATO_FECHA_INVERTIDO
Constant attribute that represents the date format
"dd-MM-yyyy". |
static java.lang.String |
FORMATO_FECHA_JUNTA
Constant attribute that represents the date format
yyyyMMddHHmmss. |
static java.lang.String |
FORMATO_FECHA_JUNTA_ADICIONAL
Constant attribute that represents the date format
"yyyyMMddHHmmss.SZ". |
static java.lang.String |
FORMATO_FECHA_JUNTA_CORTA
Constant attribute that represents the date format
yyyyMMdd. |
static java.lang.String |
FORMATO_FECHA_UTC
Constant attribute that represents the date format
"yyyy-MM-dd'T'HH:mm:ss.SSS". |
static java.lang.String |
FORMATO_HORA
Constant attribute that represents the date format
HH:mm:ss. |
static java.lang.String |
FORMATO_SEMICOMPLETO
Constant attribute that represents the date format
"yyyy-MM-dd HH:mm:ss ZZZZ". |
| Constructor and Description |
|---|
UtilsTime()
Constructor method for the class UtilsTime.java.
|
UtilsTime(java.util.Calendar c)
Constructor method for the class UtilsTime.java.
|
UtilsTime(java.util.Date pFecha)
Constructor method for the class UtilsTime.java.
|
UtilsTime(java.lang.String timezone)
Constructor method for the class UtilsTime.java.
|
UtilsTime(java.lang.String fechaStr,
java.lang.String formato)
Constructor method for the class UtilsTime.java.
|
UtilsTime(java.util.TimeZone t)
Constructor method for the class UtilsTime.java.
|
| Modifier and Type | Method and Description |
|---|---|
static java.util.Date |
convierteFecha(java.lang.String fecha,
java.lang.String patron)
Method that obtains a date from a string using a determined pattern.
|
java.util.Date |
getFecha()
Gets the value of the attribute
fecha. |
static java.lang.String |
getFechaMasNDias(java.lang.String fechaEnt,
int diasAdd)
Method that adds a number of days to certain date.
|
static java.lang.String |
getFechaSistema(java.lang.String formato)
Method that obtains the current date and hour of the system.
|
static java.util.Date |
getUTCDate(java.lang.String utcDate)
Method that obtains a date from a string with
UTC format. |
static java.lang.String |
modificarFormato(java.lang.String fecha,
java.lang.String formatoOriginal,
java.lang.String nuevoFormato)
Method that modifies the format of a date.
|
void |
setFecha(java.util.Date pFecha)
Sets the value of the attribute
fecha. |
void |
sumar(int numDias)
Method that adds a number of days to the date.
|
java.lang.String |
sumarDias(int numDias)
Method that adds a number of days to the system date.
|
java.lang.String |
toString() |
java.lang.String |
toString(java.text.SimpleDateFormat formador)
Method that obtains a string with the value of the date for certain format.
|
java.lang.String |
toString(java.lang.String formato)
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. |
public static final java.lang.String FORMATO_COMPLETO
yyyy-MM-dd EEE HH:mm:ss ZZZZ.public static final java.lang.String FORMATO_FECHA
yyyy-MM-dd.public static final java.lang.String FORMATO_HORA
HH:mm:ss.public static final java.lang.String FORMATO_FECHA_HORA
yyyy-MM-dd HH:mm:ss.public static final java.lang.String FORMATO_FECHA_CORTO
dd/MM/yyyy.public static final java.lang.String FORMATO_FECHA_JUNTA
yyyyMMddHHmmss.public static final java.lang.String FORMATO_FECHA_JUNTA_CORTA
yyyyMMdd.public static final java.lang.String FORMATO_FECHA_BAJA
dd_MM_yyyy.public static final java.lang.String FORMATO_FECHA_ESTANDAR
"dd/MM/yyyy HH:mm:ss".public static final java.lang.String FORMATO_FECHA_BARRAS
"dd/MM/yyyy/HH/mm/ss".public static final java.lang.String FORMATO_FECHA_JUNTA_ADICIONAL
"yyyyMMddHHmmss.SZ".public static final java.lang.String FORMATO_FECHA_HORA_ADICIONAL
"yyyy-MM-dd'T'HHmmssZ".public static final java.lang.String FORMATO_FECHA_HORA_COMPLETA
"yyyy-MM-dd HH:mm:ss,SSS".public static final java.lang.String FORMATO_FECHA_INVERTIDO
"dd-MM-yyyy".public static final java.lang.String FORMATO_FECHA_ESTANDAR_ADICIONAL
"dd/MM/yyyy HH:mm:ss.SSS".public static final java.lang.String FORMATO_FECHA_HORA_MINUTOS
"dd-MMM-yyyy HH:mm".public static final java.lang.String FORMATO_SEMICOMPLETO
"yyyy-MM-dd HH:mm:ss ZZZZ".public static final java.lang.String FORMATO_FECHA_UTC
"yyyy-MM-dd'T'HH:mm:ss.SSS".public static final java.lang.String FORMATO_COMPLETO_ADICIONAL
"yyyy/MM/dd EEE hh:mm:ss zzzz".public static final java.lang.String FORMATO_FECHA_HORA_SEGUNDOS
"dd-MM-yy_HH-mm-ss".public UtilsTime()
public UtilsTime(java.util.Date pFecha)
pFecha - Parameter that represents the value of the date.public UtilsTime(java.util.Calendar c)
c - Parameter that represents the object to set the value of the date and the time zone offset.public UtilsTime(java.util.TimeZone t)
t - Parameter that represents the time zone offset.public UtilsTime(java.lang.String timezone)
timezone - Parameter that represents the identifier for the time zone offset.public UtilsTime(java.lang.String fechaStr,
java.lang.String formato)
throws java.text.ParseException
fechaStr - Parameter that represents the value of the date.formato - Parameter that represents the format used for the date.java.text.ParseException - If the method fails.public java.lang.String toString(java.lang.String formato)
formato - Parameter that represents the format to apply for the date.public java.lang.String toString(java.text.SimpleDateFormat formador)
formador - Parameter that represents the concrete object for formatting and parsing the date in a locale-sensitive manner.public 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 getFechaSistema(java.lang.String formato)
formato - Parameter that represents the format used to obtain the date.public java.lang.String toString()
toString in class java.lang.ObjectObject.toString()public java.util.Date getFecha()
fecha.fecha.public void setFecha(java.util.Date pFecha)
fecha.pFecha - The value for the attribute fecha.public void sumar(int numDias)
numDias - Parameter that represents the number of days to add.public static java.lang.String modificarFormato(java.lang.String fecha,
java.lang.String formatoOriginal,
java.lang.String nuevoFormato)
throws java.text.ParseException
fecha - Parameter that represents the date.formatoOriginal - Parameter that represents the original format.nuevoFormato - Parameter that represents the new format.java.text.ParseException - If the method fails.public java.lang.String sumarDias(int numDias)
throws java.text.ParseException
numDias - Parameter that represents the number of days to add.yyyy-mm-dd.java.text.ParseException - If the method fails.public static java.lang.String getFechaMasNDias(java.lang.String fechaEnt,
int diasAdd)
throws java.text.ParseException
fechaEnt - Parameter that represents the date to add the days. It's a string with YYYYMMDD format.diasAdd - Parameter that represents the number of days to add.yyyyMMDD.java.text.ParseException - If the method fails.public static java.util.Date convierteFecha(java.lang.String fecha,
java.lang.String patron)
throws java.text.ParseException
fecha - Parameter that represents the string to transform in date.patron - Parameter that represents the pattern used to generate the date.java.text.ParseException - If the method fails.