sci

Ingy döt Net 2024-12-19T14:07:39.853089Z

I noticed this in ys but can show in bb:

$ date ; bb '(import java.time.LocalDateTime) (str (.toLocalTime (LocalDateTime/now)))'
Thu 19 Dec 2024 09:05:12 AM EST
"06:05:12.127162"
Where is the tz coming from?

borkdude 2024-12-19T14:08:52.363809Z

I guess this is a regular Java question, not SCI or bb specific

Ingy döt Net 2024-12-19T14:11:46.909219Z

Should I ask in #babashka if anyone has run into this with bb?

Ingy döt Net 2024-12-19T14:12:22.926469Z

I'll try with clj, sec

borkdude 2024-12-19T14:12:42.895429Z

It is not bb specific, as I already said. It's just how Java works

borkdude 2024-12-19T14:13:41.389349Z

So I'd ask this in #clojure or so, which is the most general channel for asking Clojure/Java-related questions

Ingy döt Net 2024-12-19T14:13:48.003059Z

thanks

Ingy döt Net 2024-12-19T14:14:27.355679Z

also

$ clojure -M -e '(import java.time.LocalDateTime) (str (.toLocalTime (LocalDateTime/now)))'
java.time.LocalDateTime
"06:13:31.599081166"

borkdude 2024-12-19T14:15:03.929269Z

if you want to format a date like date look into formatting

Ingy döt Net 2024-12-19T14:16:18.348119Z

I was just using date to show my real TZ there (and how java differed from that)

Ingy döt Net 2024-12-19T14:19:49.183879Z

ZonedDateTime vs LocalDateTime... hrmm... Maybe Local means California (where Java was invented) 😉

borkdude 2024-12-19T14:20:19.842519Z

:)

Ingy döt Net 2024-12-19T14:21:28.420039Z

https://stackoverflow.com/a/52564512/721703

Ingy döt Net 2024-12-19T14:21:44.555559Z

TIL

👍 1
souenzzo 2024-12-23T16:21:04.305109Z

On my pc (macos//java 23)

date; clj -M -e '(import java.time.LocalDateTime) (str (.toLocalTime (LocalDateTime/now)))'
Mon Dec 23 13:19:21 -03 2024
java.time.LocalDateTime
"13:19:21.869119"

Ingy döt Net 2024-12-23T16:58:59.267619Z

After reading some java doc, I believe the TZ is cached. Not sure where. I was on the US west coast when I last rebooted (likely cache time). And on east coast when I ran into this issue... Thus the 3 hour diff.

Ingy döt Net 2024-12-23T17:06:59.369139Z

I think it was here https://docs.oracle.com/javase/8/docs/api/java/util/TimeZone.html#getDefault-- > Gets the default TimeZone of the Java virtual machine. If the cached default TimeZone is available, its clone is returned.