Is there some function in Java, for parsing timestamp to decimal?
Input: 2023-07-04 00:00:00.0
Expected output: 1687771449497
Is there some function in Java, for parsing timestamp to decimal?
Input: 2023-07-04 00:00:00.0
Expected output: 1687771449497
If you're using LocalDateTime
for you timestamp representation in Java code, so you can you the following approach to convert timestamp into epoch millis:
LocalDateTime localDateTime = LocalDateTime.of(2023, 7, 4, 0, 0);
ZonedDateTime zdt = ZonedDateTime.of(localDateTime, ZoneId.systemDefault());
long millis = zdt.toInstant().toEpochMilli();