jean01/26/2022, 10:21 AM
to it’s equivalent in another time zone? I tried this :
internal fun String.localDateTime(): LocalDateTime = Instant.parseWithBasicOffset(this) //parseWithBasicOffset is a custom parse due to time zone written without ":" .toLocalDateTime(TimeZone.currentSystemDefault())
the date is correct but I lost the time zone there, which I need for further processing. So my question is : how do I go from
Desmond van der Meer01/26/2022, 10:48 AM
is inherently without time zone, because it literally just points to a date and time. You can combine it with a timezone to get an
back, but that will just result in the instant you started with.
. But you could create the string yourself using
ilya.gorbunov01/30/2022, 6:43 PM
when you need to get their representation in a particular time zone or offset.
jean01/31/2022, 9:11 AM
per predefined period for each compared days/months. After that I was trying to convert utc dates to local zone then to string to be able to group them by relevant criteria (value of the day if days we compared, or value of the month if months were compared). Since the month or day value of the first day of the month depends on the timezone when converted to a string (issue I posted originally) I was trying to convert it to the local value string. But I figured out I could simply use the Instant string without timezone to do so. All in all, I did not need the local string with the timezone value 🙂
date -> consumptions