Created
October 21, 2020 09:47
-
-
Save nadar71/df994a59c0b892c0b08ec68d320ac71d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.* | |
fun Calendar.resetTime(){ | |
set(Calendar.HOUR_OF_DAY, 0) | |
set(Calendar.MINUTE, 0) | |
set(Calendar.SECOND, 0) | |
set(Calendar.MILLISECOND, 0) | |
} | |
fun Calendar.endDay(){ | |
set(Calendar.HOUR_OF_DAY, 23) | |
set(Calendar.MINUTE, 59) | |
set(Calendar.SECOND, 59) | |
set(Calendar.MILLISECOND, 999) | |
} | |
// Getting hours and minute from date in minutes | |
fun Calendar.getMinuteOfDayFromDate(): Int{ | |
val hours = this.get(Calendar.HOUR_OF_DAY) | |
val minutes = this.get(Calendar.MINUTE) | |
return (hours*60 + minutes) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment