English
Time
About 124 wordsLess than 1 minute
2026-01-09
Time - Represents time in hh:mm format, enclosed in double quotes when used.
Define Time: Time time = "hh:mm"
Example:
Time time = "09:30"
Time type methods:- Time.now(): Gets the current time in hours and minutes Example:
Time t = Time.now()- time.withHour(
<Integer hour>): Sets the hour of time and returns a new time Return type: Time
Example:
time.withHour(13) //Returns: 13:30- time.withMinute(
<Integer minute>): Sets the minutes of time and returns a new time Return type: Time
Example:
time.withMinute(50) //Returns: 09:50- time.toTimestamp(): Converts time to timestamp Return type: BigDecimal
Example:
time.toTimestamp() //Returns: 4260000- time.hour: Gets the hour component of time Example:
time.hour //Returns: 9- time.minute: Gets the minute component of time Example:
time.minute //Returns: 30