I'm learning the "new" java 8 date and time apis. ...
# random
c
I'm learning the "new" java 8 date and time apis. "Local"Date and "Local"Time doesn't really make sense to me. They seem to be dates and times without any time zone data attributed to them, but if something was a Local date or time, wouldn't you WANT the locale/timezone in the date/time? I guess what I'm saying is that I don't understand the "local" name in LocalDate and LocalTime. Appreciate any pointers. time is hard.
j
I've had the same issue. My mental model now is that it's local in the sense that only two people from the same "locality" can know when a local date or time actually is when using one to talk with each other. E.g. you don't ever specify the time zone when giving an appointment to someone living in the same place as you. So they're used "locally".
k
how would you store birthdate?
1
c
@jbnizet glad to know im not alone. That's an interesting way to put it. I guess instead of LocalDate and ZonedOffsetDate, I would expect them to actually be named Date and LocalDate. Or Date and ZonedOffsetDate. lol. I guess I gotta get out of my head that Local == Locale == timezone
f
time based on the meridian through a particular place as contrasted with that of a time zone
https://www.merriam-webster.com/dictionary/local%20time
p
It really depends on the use case. For example: my birth day is always a LocalDate. I don't communicate the exact time of birth.
And then there are other usages that are really dependant on the local time. We have a fasting functionality and a user can fast for example daily from 8 am to 5 pm. If they are traveling they don't want to suddenly fast from 11 am to 7 pm.
c
I understand that birthday will always be a "LocalDate" I'm just curious if anyone knows why they decided to add Local to the front. In my mind when I think Local I think timezones. I feel like LocalDate should just be called Date or TimeZonelessDate. Maybe there's another definition of Local that I just don't understand or maybe because english isn't my first language.
Hm. some info here... https://www.threeten.org/articles/local-date.html
The “local” part of the name refers to the local time-line. Specifically, a 
LocalDate
 has no reference to a time-zone or offset from UTC/Greenwich.
p
Don't you say: My local time is 8am?
f
@Colton Idle I guess you missed the dict link above, this is just how it's called.
k
@Fleshgrinder the dictionary definition - "time based on the meridian through a particular place as contrasted with that of a time zone" - is not helpful. "time based on the meridian through a particular place" means when it's 10am Greenwich Mean Time, the local time in Bristol is 9:50am because Bristol is at 2.5 degrees west longitude. "... as contrasted with that of a time zone" means that the time in Bristol is 10am because it's in the same time zone as London. This definition of local time is the astronomical definition, not the civil one.
Interestingly, birthdays are only given in terms of local time. So this means that if you're born in, say Japan, and then you go and live in California, when you're 18 years old you're not considered an adult on your actual birthday because you have to wait one more day for the local time zone to catch up, even though you've already lived 18 full years.