NaiveDateTime is an Elixir higher-level type for representing a date and time without time-zone information. It sits alongside Date, Time, and DateTime as an abstraction built on Elixir’s foundational data types. section 2.4.11 section 2.8
Construct and inspect a naive date-time
Use the ~N sigil to create a NaiveDateTime value, then access fields such as year and hour. section 2.4.11
iex(1)> naive_datetime = ~N[2023-01-31 11:59:12.000007] iex(2)> naive_datetime.year 2023 iex(3)> naive_datetime.hour 11
Interactive example of constructing a NaiveDateTime and reading its year and hour fields. section 2.4.11
