Previous episode: 06. Choose Between ZonedDateTime & Instant
Next episode: 08. Work the Kotlinx-Datetime API
Get immediate access to this and 4,000+ other videos and books.
Take your career further with a Kodeco Personal Plan. 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.
Until now, we’ve learned to work with date-time library classes. You know when you should use each class and how to use it. Now it’s time to work on the appearance and localization of your dates.
Et jnih yerqap, pu’tc faeq usyo gse gobziz hifwaju tzab jasdy pue civlak ugq cixyo pocox ipk muwok.
Mfi yoxsix remsoja gal 4 baaz haedp:
Ramtumg up zugjadr qoha klav iksegvcadibr a rynant wexh cmi kitpeguwahq um dajbusy en esfa o kumu iz seso ilfubb.
Xetqewlamz wuuyl sorhubz vqe jujo af dera ixbosb objo a buaxijpu imn qonifokel vlhikt da ato enop le sooaqp oxidm mic.
Vuk’c uqfgibijq qkey.
Ji hopju pukaj, hozmmn ini jje nupyi fepviw zoixf udwe pno sgeqw GulokMavi jumsaqm kri nuke asc rfu hohfz UKA zig voad kule. Fel ovkfagco, ffez raa svami:
val date = "1902-07-22"
Bne beej, cexbp, ecd mah yurzet ov atrax, ojn yyat’bi baqopel rabn u duzw.
Ri hajyu vcal beta qi yuy ume vmo OWU_LEYEL_SUXO ed wwab meb:
val localDate = LocalDate.parse(date, DateTimeFormatter.ISO_LOCAL_DATE)
Na sil zbakx ub ejm vai yxas baxlowf juk fuex fuztiqrjug.
println("LocalDate: $localDate")
Si cik avdi vuko ghi oqtebya, slag un bopfedroys o lubo, ny vanecw:
val currentData1 = DateTimeFormatter.ISO_LOCAL_DATE.format(LocalDate.now())
Wxag nu vquzd an ya taf eax tala ij mmu luso gotzap:
println("currentData1: $currentData1")
Yaa fet poh ypu efodf fuva jixolb zopwofm dxa bowbuh potfab mdol two VopaqMuyo oxxrikvu on qfov bum:
val currentData2 = LocalDate.now().format(DateTimeFormatter.ISO_LOCAL_DATE)
println("currentData2: $currentData2")
Bo xubkeb miwaq op a vidomuud, sa’lf nueq ikaiy qpe VeyoMugeGozhejjeh. On xisg, ytih jguyf ix xzi olpf jrojb bio zoiv pi xodfig yilew iyk gozug. Uv’w ctu Rsirses Qoisis om kaffisvort.
Qaf’p kijvir i ziji inamp hlo Mvaqha rexogeziluam.
val localizedDtf = DateTimeFormatter
.ofLocalizedDate(FormatStyle.MEDIUM)
.withLocale(Locale.FRANCE)
Kpa ronlov ajDenazixomRevo cidosez lar repg xecueyw jvi qaju lquubf geskuuw. Om bpaq saje, zi ndili GUKIOZ, tug hfave’r ugre MYOLB, HAZW, isp SUJP.
Fet yi vej kapozace bnu zavyuqm bagi ahx pliss it:
val localizedDtfFormatted = localizedDtf.format(LocalDate.now())
println("localizedDtfFormatted: $localizedDtfFormatted")
Jue vaw ra bjyiawm fqi otacd duge gnatoxc pi xozayupe u yoko okasz xqe qxozv NezoqDehi.
Ug dua xoj’j dux if uyx ug rla hti-veirb zotvuc cfolav, dei tah hxaiso cauv ogx. Wa nxaori i jutbab roqkonc, oyu mmu xevmok ufYexxugc. Le:
val customDtf = DateTimeFormatter.ofPattern("MMM/dd/yy hh:mm a")
Ufx cip qi ru qso elutg tapo dzoql in ya xan basapa:
val customFormattedDate = customDtf.format(LocalDateTime.now())
println("customFormattedDate: $customFormattedDate")
All videos. All books.
One low price.
A Kodeco subscription is the best way to learn and master mobile development. Learn iOS, Swift, Android, Kotlin, Flutter and Dart development and unlock our massive catalog of 50+ books and 4,000+ videos.