Make a date with Postgres
A practical guide to the key concepts for handling date-time values with a Postgres database.
Presented by:
Software Developer, working with micro-startups & small teams to build niche software, typically database-backed desktop-style enterprise-oriented web apps running server-side in pure Java on the Vaadin framework.
Previously worked in long-term client engagements building in-house custom-crafted departmental database apps for cost accounting, business operations, and workflow.
Also spent a couple years as a trainer teaching software development (database, business logic, and user-interface) to developers both novice and expert in week-long seminars.
Hobbies include extreme dog-walking and welding bird-cages. And spending way too much time on Stack Overflow.
This talk is a practical guide to the core concepts for handling date-time values with a Postgres database.
Working with date-time values is surprisingly tricky and complicated. Our intuitive understanding of the clock and calendar actually works against us as database admins and developers. Issues like time zones, offsets, UTC/GMT, Daylight Saving Time (DST), epoch, Leap Year, Leap Second, and historical anomalies create confusing complications. Add to that the very poor support for date-time handling in most databases and programming languages, and we have a troublesome mess.
Let’s walk through the fundamental concepts behind tracking time. First we cover how computers track time, with the epoch reference date, a count-from-epoch, and the resolution/granularity of that count. Then we move on to the exact meaning of UTC/GMT, offsets from UTC, and come to understand time zone as a history of those offsets.
With this understanding of zoned time in place, we move on to un-zoned “local” time. Through practical examples of scheduling and logistics planning, we learn when to use zoned time and when to use un-zoned time.
We explore these zoned and un-zoned notions of time first by looking at the core classes of the java.time framework newly added to Java. Some simple one-line programming examples exercise all the concepts discussed above.
We move on to map those concepts to the standard SQL data types for date-time, and to the data types found in Postgres. We practice these concepts with a series of business cases such as dental appointments, milking cows, and closing on the purchase of a home.
Along the way, some practical tips challenge you to shift your thinking to avoid confusion during date-time work. For example, we learn to not conflate date-time values with strings representing those values.
This guided tour of Postgres data types for date-time will leave you ready and certain when choosing the right type for your data. Replace your hope-and-prayer approach to date-time handling with a new confidence built on clear understanding. Handling date-time will be much easier, more predictable, and even enjoyable.
- Date:
- Duration:
- 45 min
- Room:
- HC-103 Postgres
- Conference:
- LinuxFest Northwest 2018
- Language:
- Track:
- PostgreSQL
- Difficulty:
- Easy
- The Complete History of Linux (abridged)
- Start Time:
- 2018 April 28 07:15
- Room:
- HC-108
- Documentation is Teaching, and Teaching is Everything
- Start Time:
- 2018 April 28 07:15
- Room:
- CC-201 TUT1
- Building Your own Cloud on a Pi
- Start Time:
- 2018 April 28 07:15
- Room:
- CC-202 TUT2
- Proxmox Hypervisor - Open Source LXC and KVM management
- Start Time:
- 2018 April 28 07:15
- Room:
- CC-235
- Moving Forward with Firewalld
- Start Time:
- 2018 April 28 07:15
- Room:
- CC-200
- digiKam Ninja Tricks
- Start Time:
- 2018 April 28 07:15
- Room:
- CC-208
- Why C? Refuting C++ Pretentiousness
- Start Time:
- 2018 April 28 07:15
- Room:
- CC-236
- IndieWeb 101: owning your content and identity
- Start Time:
- 2018 April 28 07:15
- Room:
- CC-115
- Do Licenses Drive Communities or Do Communities Drive Licenses?
- Start Time:
- 2018 April 28 07:15
- Room:
- G-103
- Linux Jargon
- Start Time:
- 2018 April 28 07:15
- Room:
- CC-114
- Make a date with Postgres
- Start Time:
- 2018 April 28 07:15
- Room:
- HC-103 Postgres
- Linux Professional Institute: LPIC-1 Cram Session
- Start Time:
- 2018 April 28 07:30
- Room:
- HC-112 LPI