Type | Name and description |
---|---|
java.lang.String |
addDays(java.lang.String stringDate, java.lang.String dateFormat, int amount) Add days to a particular date |
java.util.Date |
convertString2Date(java.lang.String value, java.lang.String dateTimeFormat) Convert a string to date |
java.lang.String |
formatStringDate(java.lang.String value, java.lang.String currentFormat, java.lang.String newFormat) Format a string date |
static int |
getCurrentDate() Get current date |
static java.lang.String |
getCurrentDateTime(java.lang.String timeZoneId, java.lang.String dateTimeFormat) Get current date time |
static int |
getCurrentMonth() Get current month |
static int |
getCurrentYear() Get current year |
static java.lang.String |
getDayOfWeek(java.lang.String date, java.lang.String dateFormat) Get the day of the week |
static java.util.TimeZone |
getDefaultTimeZone() Get the default TimeZone |
static java.time.Duration |
getDuration(java.lang.String startTime, java.lang.String endTime) Get duration |
static java.lang.String |
getFutureDateTime(int noOfDays, java.lang.String timeZoneId, java.lang.String dateTimeFormat) Get noOfDays days after the current date |
static java.lang.String |
getFutureTime(int hrs, int minute) Get future time |
static java.lang.String |
getPastTime(int hrs, int minute) Get past time |
static java.lang.String |
getPreviousDateTime(int noOfDays, java.lang.String timeZoneId, java.lang.String dateTimeFormat) Get noOfDays days previous to current date |
static java.lang.Object |
setDefaultTimeZone(java.lang.String timeZoneId) Set the default TimeZone |
Methods inherited from class | Name |
---|---|
class java.lang.Object |
java.lang.Object#wait(), java.lang.Object#wait(long, int), java.lang.Object#wait(long), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll() |
Add days to a particular date
stringDate
- the date needs to add more daysdateFormat
- the format of the date stringamount
- the number of days adding to the dateConvert a string to date
value
- the date string needs to convertdateTimeFormat
- the format of the date stringFormat a string date
value
- the date needs to reformatcurrentFormat
- the current format of the string datenewFormat
- the expected format of the string dateGet current date
Get current date time
timeZoneId
- TimeZone Id. If the timeZoneId is null, it will use the local TimeZonedateTimeFormat
- the date time format. If the dateTimeFormat is null, the default format set to "dd-MM-yyyy hh:mm:ss a"Get current month
Get current year
Get the day of the week
date
- the date stringdateFormat
- the date formatGet the default TimeZone
Get duration
startTime
- the start timeendTime
- the end timeGet noOfDays days after the current date
noOfDays
- the days after the current datetimeZoneId
- TimeZone Id. If the timeZoneId is null, it will use the local TimeZonedateTimeFormat
- the date format. If the dateTimeFormat is null, the default format set to "MM/dd/yyyy"Get future time
hrs
- the hours adding to the current hourminute
- the minutes adding to the current minuteGet past time
hrs
- the hours subtracting from the current hourminute
- the minutes subtracting the current minuteGet noOfDays days previous to current date
noOfDays
- the days previous to current datetimeZoneId
- TimeZone Id. If the timeZoneId is null, it will use the local TimeZonedateTimeFormat
- the date format. If the dateTimeFormat is null, the default returned date time format is "dd-MM-yyyy hh:mm:ss a"Set the default TimeZone
timeZoneId
- TimeZone Id. If the timeZoneId is null, it will use the local TimeZone