Package com.github.toolarium.common.util
Class DateUtil
java.lang.Object
com.github.toolarium.common.util.DateUtil
Date converter utility.
-
Method Summary
Modifier and TypeMethodDescriptioncreateDate(int year, int month, int day) Creates a date from the given datacreateTimeStamp(int year, int month, int day) Creates a date from the given datacreateTimeStamp(int year, int month, int day, int hour, int min, int sec, int miliSec) Creates a date from the given datastatic DateUtilGet the instanceParse a dateParse a dateParse the timeConvert toDate.toDate(LocalDateTime dateToConvert) Convert toDate.toDateString(Instant instant) Converts a given date back into toolarium-date-notation and returns a well formed string of the following format: <dd.mm.yyyy@HH24:MI:SS>toDateString(Instant instant, String sep) Converts a given date back into toolarium-date-notation and returns a well formed string of the following format: <dd.mm.yyyy@HH24:MI:SS>toDateString(Date date) Converts a given date back into toolarium-date-notation and returns a well formed string of the following format: <dd.mm.yyyy@HH24:MI:SS>toDateString(Date date, String sep) Converts a given date back into toolarium-date-notation and returns a well formed string of the following format: <dd.mm.yyyy@HH24:MI:SS>toLocalDate(Date dateToConvert) Convert toLocalDate.toLocalDateTime(Date dateToConvert) Convert toLocalDateTime.toTimestampString(Date date) Converts a given date back into an iso standard: <yyyy-mm-ddTHH24:MI:SS>
-
Method Details
-
getInstance
Get the instance- Returns:
- the instance
-
createDate
Creates a date from the given data- Parameters:
year- the yearmonth- the month (January starts with 0)day- the day (start with 1)- Returns:
- the date
-
createTimeStamp
Creates a date from the given data- Parameters:
year- the yearmonth- the month January starts with 0)day- the day (start with 1)- Returns:
- the date
-
createTimeStamp
Creates a date from the given data- Parameters:
year- the yearmonth- the month (January starts with 0)day- the day (start with 1)hour- the hour (24h)min- the minutesec- the secondsmiliSec- the milliseconds- Returns:
- the date
-
toLocalDate
Convert toLocalDate.- Parameters:
dateToConvert- the date to convert- Returns:
- the local date
-
toLocalDateTime
Convert toLocalDateTime.- Parameters:
dateToConvert- the date to convert- Returns:
- the local date time
-
toDate
Convert toDate.- Parameters:
dateToConvert- the date to convert- Returns:
- the date
-
toDate
Convert toDate.- Parameters:
dateToConvert- the date to convert- Returns:
- the date
-
parseTime
Parse the time- Parameters:
time- the time to parse like: 11:22- Returns:
- the parsed time as date
- Throws:
IllegalArgumentException- In case of invalid time format
-
parseDate
Parse a date- Parameters:
date- the date to parse like: 10.02.2004, 10.2.04@11:22- Returns:
- the date
- Throws:
IllegalArgumentException- In case of invalid dateformat
-
parseDate
Parse a date- Parameters:
date- the date to parse like: 10.02.2004, 10.2.04@11:22timeSeparator- the time separator- Returns:
- the date
- Throws:
IllegalArgumentException- In case of invalid dateformat
-
toDateString
Converts a given date back into toolarium-date-notation and returns a well formed string of the following format: <dd.mm.yyyy@HH24:MI:SS>- Parameters:
date- the date object- Returns:
- date as string
-
toDateString
Converts a given date back into toolarium-date-notation and returns a well formed string of the following format: <dd.mm.yyyy@HH24:MI:SS>- Parameters:
date- the date objectsep- the separator- Returns:
- date as string
-
toDateString
Converts a given date back into toolarium-date-notation and returns a well formed string of the following format: <dd.mm.yyyy@HH24:MI:SS>- Parameters:
instant- the instant object- Returns:
- date as string
-
toDateString
Converts a given date back into toolarium-date-notation and returns a well formed string of the following format: <dd.mm.yyyy@HH24:MI:SS>- Parameters:
instant- the instant objectsep- the separator- Returns:
- date as string
-
toTimestampString
Converts a given date back into an iso standard: <yyyy-mm-ddTHH24:MI:SS>- Parameters:
date- the date object- Returns:
- date as string
-