public interface IDateUtil
Define common Date/Calendar operations
- Since:
- 1.0.0
- Version:
- 1.1.0
- Author:
- yui-KITAMURA
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionfromStr(String input, IDateUtil.Formats format) now()Get Calendar instance of current DateTime.toStr(Calendar calendar, IDateUtil.Formats format) String formatter withIDateUtil.FormatstoStr(Date date, IDateUtil.Formats format) String formatter withIDateUtil.Formats
-
Method Details
-
now
Get Calendar instance of current DateTime.- Returns:
- instance of current DateTime
-
toDate
- Parameters:
calendar- original instance of Calendar- Returns:
- the Date instance that has same timestamp with parameter
-
toCal
- Parameters:
date- original instance of Date- Returns:
- the Calendar instance that has same timestamp with parameter
-
toStr
@Contract("null, null -> fail; null, _ -> null; !null, _ -> new") String toStr(Calendar calendar, IDateUtil.Formats format) String formatter withIDateUtil.Formats- Parameters:
calendar- Calendar instance to be formattedformat- the output format that you want to get- Returns:
- the string value which the argument of calendar formatted with selected format
-
toStr
@Contract("null, null -> fail; null, _ -> null; !null, _ -> new") String toStr(Date date, IDateUtil.Formats format) String formatter withIDateUtil.Formats- Parameters:
date- Date instance to be formattedformat- the output format that you want to get- Returns:
- the string value which the argument of date formatted with selected format
-
fromStr
@Contract("null, null -> fail; null, _ -> null; !null, _ -> new") Calendar fromStr(String input, IDateUtil.Formats format) - Parameters:
input- convert target textformat- the text format- Returns:
- the Calendar instance which has the time given with the input
- Throws:
IllegalArgumentException- when failed to convert- Since:
- 1.1.0
-
toTS
- Parameters:
calendar- original Calendar instance- Returns:
- the Timestamp instance that has same DateTime with argument
-
toTS
- Parameters:
date- original Date instance- Returns:
- the Timestamp instance that has same DateTime with argument
-