在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):hotchemi/khronos开源软件地址(OpenSource Url):https://github.com/hotchemi/khronos开源编程语言(OpenSource Language):Kotlin 100.0%开源软件介绍(OpenSource Introduction):khronosAn intuitive Date extensions in Kotlin. UsageAdd durations to dateval today = Dates.today
val nextWeek = today + 1.week
val dayBeforeYesterday = today - 2.days
// shortcuts #1
val tomorrow = Dates.tomorrow
val yesterday = Dates.yesterday
// shortcuts #2
val yesterday = 1.days.ago
val fiveYearsSince = 5.years.since Initialize by specifying date componentsval birthday = Dates.of(year = 1990, month = 1, day = 21)
val firstCommitDate = Dates.of(year = 2016, month = 2, day = 26, hour = 18, minute = 58, second = 31, millisecond = 777) Initialize by changing date componentsval today = Dates.today
val christmas = today.with(month = 12, day = 25)
val thisSunday = today.with(weekday = 1)
// shortcuts
val newYearDay = today.beginningOfYear
val newYearsEve = today.endOfYear Check day of the weekDates.today.isFriday() // false Format and parse5.minutes.since.toString("yyyy-MM-dd HH:mm:ss")
//=> "2015-03-01 12:05:00"
"1987-06-02".toDate("yyyy-MM-dd")
//=> Dates.of(year = 1987, month = 6, day = 2) Compare dates1.day.ago > 2.days.ago // true
1.day.ago in 2.days.ago..Dates.today // true Installdependencies {
compile 'com.github.hotchemi:khronos:${latest.version}'
} Notice
Licence
|
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论