help with date in kotlin please!!! :( | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

help with date in kotlin please!!! :(

i'm new programming :( i want that my apk gets the date to make with it a search in a database. for example, today is 6th october, so my apk has to get the date (2020-10-06) and get the information i have in my database with 2020-10-06 as primary key....... i hope you can understand me... my english is a bit poor 😅 thank u!!!

6th Oct 2020, 10:33 AM
Marina Camacho Rivero
Marina Camacho Rivero - avatar
1 Answer
+ 3
Android kotlin To format our date to different formats we can use LocalDate‘s format() method and supply to it our custom format using DateTimeFormatter: var formatter = DateTimeFormatter.ofPattern("dd-MMMM-yyyy") var formattedDate = date.format(formatter) This outputs a nicely formatted date: assertThat(formattedDate).isEqualTo("31-December-2018"
6th Oct 2020, 11:52 AM
Isaac Hernandez Sanchez
Isaac Hernandez Sanchez - avatar