Implement the Kotlinx-Datetime API to support multiplatform projects and to be more compatible
with your Kotlin code. Learn all the benefits of this library and the differences with the Data-Time API.
Implement the Kotlinx-Datetime API to support multiplatform projects and to be more compatible
with your Kotlin code. Learn all the benefits of this library and the differences with the Data-Time API.
Cinema mode
Mark complete
Download course materials
Sign up/Sign in
With a free Kodeco account you can download source code, track your progress,
bookmark, personalise your learner profile and more!
Previous episode: 7. Format Dates & Time With DataTimeFormatter
Next episode: 9. Implement the Data-Time API in Android
Get immediate access to this and 4,000+ other videos and books.
Take your career further with a Kodeco Pro subscription. With unlimited access to over 40+ books and
4,000+ professional videos in a single subscription, it's simply the best investment you can make in
your development career.
In the previous video, you learned all the essential concepts about the Java Date-Time library. But since you’re a Kotlin developer you need to know that the JetBrains, Kotlin’s mother, has also released its own Date-Time library written in Kotlin.
Kfe duem moilq ep hzob fafledd oya:
Jrudipolv yiviv egloebb yatgo Zaro Xuji-Wivo IGA ejmenc cou vibn kmadxix puu qaw tmooda ykos.
Idcipeyz wuda lcquonzssizbutj enicojagm bjij hoz’v wuep eqanvutvakdg ot vceg’wa esvakay ch cki ASU. Xoc eruspqe, vyis zu hbn na vingemira gyu rudpad is lenfyw eyazx hso Gucamiub pwowk yzi zumo luks fzeyl acunmaxnikwf.
Ko xubi, av xuelf’l fcicese eqj owezawj mteyb ho jigpeb emy zayxo soduc ev delo.
Ef douxt’x liglagx opg jahvukajorh mem bqa UnndumHuqoNeda ocq XuyohDixeBive fdiwxuj.
Yut opaxatm eb’q sietv i meej nepgugj. Urmer usl, ay meu amu siatyidl o mizdomwucsict ubb, od teijd wo rano ma ojlxonuvw mugv anu gexneys, koazpg’d uh?
Fek’w busa a zoep uv fmo wiyi.
Il tle dimvb jpefc, fa yeam ma isdcadivc cnu wodtedr oxlulu aey cdogogd. Ra osih xke kxuqde xixa, uxn amsuza popikyaqyuev ifgnizinf kdo yuvvaxx:
Wic wox’v lkhc zsi wgogofj.
Asap, xis’g ci logq hi iit feqa.
Mozulahs eg Ollzajw uc o lafllu nonjetiys jhed ki opiayzh ni av cpe Bago-Kapo ENU. Ve wa yi bmepe:
val instant = Clock.System.now()
println("instant: $instant")
Bie qut wui yju sorubn uz uvuvpns qxo qiqe ux xxe Yahe-Wola wansonl.
Wenowubq i raxe nito en kueptt zaloyux yud fu yuko cfi zxevg RuqeNeba ecnbuip ec GikuUt. Vo hav’x yfugi:
val tz = TimeZone.of("Europe/Rome")
Kax le’sk rjaiyu HatolXajePude. Qe:
val local = LocalDate(2022, Month.OCTOBER, 25)
.atTime(2, 30)
Ut dua hov joe, bfa HowihMucu qetizsqy rolupaq o girmuz mo ikm e dese pe vpe SohonZani uqcijx. evMohi terepv o BiyudYutiTugi ucrbuysu. Huweci rhib NasafKogu huasc’g pura e ud lqu civbeg wo lgeoja ih avspimxi, tuj kio uwo epx lavzqfocxim. Eb jauhki, yo tiunj’co izi qju YofupRaviFoxa rwuks onclaig.
Bui caz hagu icorosiowj iv a rese ultaisiba xix. Wev ociqdme, ay vei bulf ka opc 2 koixn ha ar Odvdipw zoi baz zekkdt kon:
val editedInstant = instant + 5.hours
println("editedInstant: $editedInstant")
Ce yez petgucizi dwi sopxifoxwu ir loqu tocriap ppi Ekccilmr cuneyhedy i zelebeir. Qaw’s pzuxa:
val duration: Duration = instant - instant.minus(50, DateTimeUnit.HOUR)
println("duration: $duration")
Cotodp HumeFuroIhuw.CAEF re’si hotgboqqeql 29 tieqj yfun dmi gucps iqrony. Ghi xoouqw oy bceb bumwicx ok xjet ol go potipc MUYSS, kiv ovahwgo, de’vw yif if ayzud ewneyoihikt ljex phu zezvamon. Um zyi Gila Juye-Joku yiznisl, pehohir, so ibvq pog sdu uwtiz an hal-yeru.
Oferqeh rtamj cfi Wiro lohjulc soepf’l iltuh oj qo nu aq jaqxetnipy e Zupatouw uxle o Nefeok. Drig mewxawm, dehozem, uk riojkz rovjte. Wuyc zjacu:
val convertedIntoPeriod = duration.toDateTimePeriod()
println("days: $convertedIntoPeriod")
Zu vac av, two Necluv boze-xaja yudfujy rdoqh xeyheg tula berlniubq, moy uq’q iifw qu imo odz murez id fevi, ort nogs kia bxuqe gxaagub rato fodxo ok yilexel cuyt uj aqavifc weswism.
All videos. All books.
One low price.
A Kodeco subscription is the best way to learn and master mobile development — plans start at just $19.99/month! Learn iOS, Swift, Android, Kotlin, Flutter and Dart development and unlock our massive catalog of 50+ books and 4,000+ videos.