public final class DateUtil extends Object
| Modifier and Type | Method and Description |
|---|---|
static String |
dateISO(Date date)
Returns the given date as an ISO date string ( "YYYY-MM-DD" )
|
static String |
dateTimeISO(Date date)
Returns the given date as an ISO date and time string ( "YYYY-MM-DD HH:MM:SS" )
|
static String |
format(Date date,
String sFormat)
Format the given date using the given format
|
static String |
format(int iDay,
int iMonth,
int iYear)
Format the given day, month and year ( in ISO format )
|
static String |
format(int iDay,
int iMonth,
int iYear,
String sFormat)
Format the given day, month and year
|
static int |
getDay(Date date)
Returns the day of the month for the given date
|
static int |
getMonth(Date date)
Returns the month of the given date
|
static Date |
getSqlDate(int iDay,
int iMonth,
int iYear)
Returns a java.sql.Date instance for the given day, month and year
|
static Date |
getUtilDate(int iDay,
int iMonth,
int iYear)
Returns a standard java.util.Date instance for the given day, month and year
|
static int |
getYear(Date date)
Returns the year of the given date
|
static Date |
parse(String sDate)
Returns the Date instance corresponding to the given date/time/datetime parameter in ISO format :
. "" or null : returns null . |
static Date |
parseDate(String sDate)
Parse the given date ( supposed to be in ISO format : "YYYY-MM-DD" )
|
static Date |
parseDateTime(String sDateTime)
Parse the given date & time ( supposed to be in ISO format : "YYYY-MM-DD HH:MM:SS" )
|
static Date |
parseTime(String sTime)
Parse the given time ( supposed to be in ISO format : "HH:MM:SS" )
|
static String |
timeISO(Date date)
Returns the given date as an ISO time string ( "HH:MM:SS" )
|
static Date |
todaySqlDate()
Returns the current date as java.sql.Date
|
static String |
todayString(String sFormat)
Returns the current date as a String formated with the given format
|
static Date |
todayUtilDate()
Returns the current date as java.util.Date
|
public static Date todaySqlDate()
public static Date todayUtilDate()
public static String todayString(String sFormat)
sFormat - the format to applypublic static String format(int iDay, int iMonth, int iYear, String sFormat)
iDay - the day ( 1 to 31 )iMonth - the month ( 1 to 12 )iYear - the yearsFormat - the format string usable to build a SimpleDateFormatpublic static String format(int iDay, int iMonth, int iYear)
iDay - the day ( 1 to 31 )iMonth - ( 1 to 12 )iYear - the yearpublic static String format(Date date, String sFormat)
date - sFormat - public static Date getSqlDate(int iDay, int iMonth, int iYear)
iDay - the day ( 1 to 31 )iMonth - the month ( 1 to 12 )iYear - the yearpublic static Date getUtilDate(int iDay, int iMonth, int iYear)
iDay - the day ( 1 to 31 )iMonth - the month ( 1 to 12 )iYear - the yearpublic static int getDay(Date date)
date - public static int getMonth(Date date)
date - :public static int getYear(Date date)
date - :public static String dateISO(Date date)
date - public static String timeISO(Date date)
date - public static String dateTimeISO(Date date)
date - public static Date parse(String sDate)
sDate - RuntimeException - if the given string cannot be convertedpublic static Date parseDate(String sDate)
sDate - TelosysRuntimeException - if the date is invalidpublic static Date parseTime(String sTime)
sTime - TelosysRuntimeException - if the time is invalidpublic static Date parseDateTime(String sDateTime)
sDateTime - TelosysRuntimeException - if the time is invalidCopyright © 2016. All rights reserved.