11 questions
0
votes
0
answers
92
views
How to convert milliseconds with included offset to Instant with offset android kotlin using kotlinx-datetime library
I have time in milliseconds where my time zone is already used (I am in UTC+3 zone)
Let it be 1742747760000 and it is actually equal to 2025-03-23T16:36:00+03:00
I take my time in milliseconds, than ...
0
votes
1
answer
83
views
how to parse date 2025-03-20T12:45:00Z to 2025-03-20T12:45+03:00 kotlinx-datetime android
i have a timestamp in milliseconds (for example, 1710929100000) (Long). First i convert it to Instant selectedDateTimeMillis.toInstant() and get a output: 2025-03-20T12:45:00Z. Now, I need to format ...
0
votes
1
answer
1k
views
LocalDate in an stable class in jetpack compose
I want to have a field in a data class that is type of java.time.LocalDate or kotlinx.datetime.LocalDateTime. This class will be consumed in a composable method.
But in metric report this class is ...
9
votes
2
answers
2k
views
Localizing month name using kotlinx-datetime library
I use the kotlinx-datetime library to get and compare with the user's current date.
I ran into a problem that:
SomeInstant.toLocalDateTime(TimeZone.currentSystemDefault()).month.name
Returns the name ...
3
votes
2
answers
5k
views
How to get current date with reset time 00:00 with Kotlinx.LocalDateTime?
I'm using kotlinx.Clock.now() to get current date. Next I need to convert this date to LocalDateTime, here is my code:
Clock.System.now().toLocalDateTime(TimeZone.currentSystemDefault())
It works ...
1
vote
0
answers
698
views
Kotlinx date time how to get last year?
I'm using Kotlinx.dateTime. And I need to get the current date and the current date - 12 months.
Here is my code for current date:
val currentDate: LocalDateTime = Clock.System.now()
....
4
votes
1
answer
5k
views
Kotlin difference between two LocalDateTime
I have two kotlinx.datetime.LocalDateTime instances:
val startDate =
LocalDateTime(year = 2020, month = Month.MARCH, dayOfMonth = 25, hour = 10, minute =
36, second = 12)
val endDate =
LocalDateTime(...
1
vote
0
answers
224
views
How to insert List<LocalDateTime> in room database?
I am using LocalDateTime from kotlinx-datetime library. Want to insert List<LocalDateTime> in Room database. Typeconverter written using Gson library. But following error showing.
java.lang....
3
votes
2
answers
3k
views
Getting days of current week using kotlinx-datetime KMM
How can I get the dates of the current week using kotlinx.datetime KMM library?
eg. I want to get a list of current week's date like:
("Monday, 07", "Tuesday, 08", "Wednesday, ...
21
votes
3
answers
14k
views
How can you format a kotlinx-datetime LocalDateTime?
I'm converting some code from using Java 8's LocalDatetime to using the version from kotlinx-datetime and I can't find any formatting methods. Specifically, I'm replacing a FormatStyle.MEDIUM. Do they ...
5
votes
0
answers
2k
views
Why does kotlinx-datetime exist? Or: Why are datatime libraries so platform dependant?
I am new to Kotlin native and stumbled upon kotlinx-datetime. Before that i was using jodatime in my android application; More specifically i was using andoid.joda.
I am wondering why these libraries ...