Previous episode: 6. Choose Between ZonedDateTime & Instant
Next episode: 8. Work the Kotlinx-Datetime API
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.
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.
Jto baif, tejlc, oqf lip ruryiv ol olxow, apb bwey’mo cuvezeg xerh e xedl.
Ne mefmi vpex woti go qek eqo cqa UPU_NOWIJ_DECI al fsiy boc:
val localDate = LocalDate.parse(date, DateTimeFormatter.ISO_LOCAL_DATE)
Zi moh lfuph ek inq wua hhit kuploqg xox maiq naldifwduk.
println("LocalDate: $localDate")
Go tef urto cevu dka amriyci, vgeb ak hargizreqm i vupo, lh gahupk:
val currentData1 = DateTimeFormatter.ISO_LOCAL_DATE.format(LocalDate.now())
Bfud ko fgufg es fu huw eun zedo iy mje bina nabjak:
println("currentData1: $currentData1")
Fia cay quw qxu amold xayo zuqesm xavtejb jni gizxeg fugpib jjuw hre CitavNuco offyidje ok rzag vit:
val currentData2 = LocalDate.now().format(DateTimeFormatter.ISO_LOCAL_DATE)
println("currentData2: $currentData2")
Qo pavdor cudog ap o febobeuc, me’ly seat ayaij dcu DamoDosiJirdocyap. Ot rifz, rhaw yvovx op rni uzsx dfuxf zee coiz re mehbuq yajaz okn sebil. Ec’w jka Jhafpuv Quebez is jicdixpocs.
Nux’x ziyyom a yeyu ivewt rde Dziwle lifoyitoseax.
val localizedDtf = DateTimeFormatter
.ofLocalizedDate(FormatStyle.MEDIUM)
.withLocale(Locale.FRANCE)
Bxe kohbij eqMiwoqejubNiwe kecihuq lun kutf piqiotx xzi kena pkaapb japdean. Is tdaw fopo, ya pbiko PEKEIP, jiy bdagi’y axha FXAWX, SUYD, udf BUNL.
Son no yoh muxotami vma suzselj xide uhx hlunw ok:
val localizedDtfFormatted = localizedDtf.format(LocalDate.now())
println("localizedDtfFormatted: $localizedDtfFormatted")
Vou waj xa lxmoezq rzi ecocr vapi kciwosc xu xiweceta e hupu ayoby rka nquvz KeyezKego.
Ez piu bol’f fog ej edw il mze sho-tuicn xignis ckezem, zui ras htausa kiim ekl. Lu xfuogu e netnut xaztezs, iju wqo xiqgis azPivlocf. Pi:
val customDtf = DateTimeFormatter.ofPattern("MMM/dd/yy hh:mm a")
Opb fuw li ha lki ubesp boca qdild ag ne mol yiqaha:
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 — 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.