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?I guess this is a regular Java question, not SCI or bb specific
Should I ask in #babashka if anyone has run into this with bb?
I'll try with clj, sec
It is not bb specific, as I already said. It's just how Java works
So I'd ask this in #clojure or so, which is the most general channel for asking Clojure/Java-related questions
thanks
also
$ clojure -M -e '(import java.time.LocalDateTime) (str (.toLocalTime (LocalDateTime/now)))'
java.time.LocalDateTime
"06:13:31.599081166"if you want to format a date like date look into formatting
https://docs.oracle.com/javase/8/docs/api/java/time/format/DateTimeFormatter.html
I was just using date to show my real TZ there (and how java differed from that)
https://chatgpt.com/share/67642ab4-abdc-8012-b31f-d26a4f94b484
ZonedDateTime vs LocalDateTime... hrmm... Maybe Local means California (where Java was invented) 😉
:)
TIL
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"
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.
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.