Tips for handling timezones in Postgres

Поделиться
HTML-код
  • Опубликовано: 17 ноя 2024

Комментарии • 45

  • @mehdi_sadeghi
    @mehdi_sadeghi Месяц назад +39

    Dude, when you were teaching MySQL back then, I really wished you’d do Postgres. Now that it’s happening, I’m really happy!

  • @MrZax-kl5si
    @MrZax-kl5si Месяц назад +10

    These videos are the best. Keep pumping this content Aaron

  • @gilesbbb
    @gilesbbb Месяц назад +4

    This is set up for covering special relativity in the next video, yes?

  • @CodingWithTaaxo
    @CodingWithTaaxo Месяц назад +4

    Hey Aaron, If you're still putting together that course, I'd be down if you could throw in a section on cron jobs. I'm learning Postgres, and your teaching style is the bomb. Can't wait to grab your course!

    • @aarondfrancis
      @aarondfrancis  Месяц назад +1

      Oh nice, added to my list!

    • @dalcod
      @dalcod Месяц назад

      That is a good suggestion.

  • @Voltra_
    @Voltra_ Месяц назад

    My personal go-to is to store dates as UTC timestamps in the database, and parse the UTC timestamp on the client side (sometimes directly, or with Date.UTC). Oh, and to never manipulate timezones (or worse, offsets)

  • @FrankGehann
    @FrankGehann Месяц назад +1

    This was a really great sum up. Thank you very much!

  • @additionaddict5524
    @additionaddict5524 Месяц назад +3

    aaron is the godfather

  • @coffeeowl86
    @coffeeowl86 Месяц назад

    Amazing content as always!
    I'm glad you're also covering Postgres.
    Best wishes 🤗
    Update: I joined the wait list for the course :D

  • @dnukeranged
    @dnukeranged Месяц назад +1

    full course hype

    • @aarondfrancis
      @aarondfrancis  Месяц назад +1

      😮‍💨 it's coming so soon! I gotta hurry!

  • @hectoreduardosolanopestana6964
    @hectoreduardosolanopestana6964 Месяц назад

    Hello Aaron, I heard in one of your videos that you were an accountant by profession. I would like to know how you transitioned to becoming a PHP developer and working with Laravel, or if you have a video where you share this story. Best regards, and thank you for your content!

  • @HashimWarren
    @HashimWarren Месяц назад

    Is the course project based? Looking forward to it

  • @fabriai
    @fabriai Месяц назад

    @Aaron, do you touch on PG Trunk in the course?

  • @nolocobralink
    @nolocobralink Месяц назад

    is there a way to show the offset on the final date without having to change the time zone on the session? for example, I'm in the America/Santiago timezone (currently on daylight saving time), and a former colleague made a small application using Postgres as the db and set UTC as the overall time zone (not just in the db), if I use the REST API of the app to check the records, all the dates will be on UTC with the offset "+00", if I ever added a query parameter that allowed me to show all the dates on a specific time zone (in this case America/Santiago), how can I implement that without changing the time zone on the session and still get the offset? ("-04" or "-03" depending on daylight saving)

  • @jrheaberlin
    @jrheaberlin Месяц назад +3

    What client are you using?

  • @djasnive
    @djasnive Месяц назад +2

    Since when did you use Postgres

  • @jricardoprog
    @jricardoprog Месяц назад

    Comparing timestamp is also annoying in pg, I need to remove 1ms to find the same record

  • @sahaj.r
    @sahaj.r Месяц назад +1

    Time stone 😄

  • @quintenkamphuis
    @quintenkamphuis Месяц назад +3

    8:30 base because Docker haha

    • @aarondfrancis
      @aarondfrancis  Месяц назад +1

      haha I dont know what I was thinking

  • @estebanmurcia8451
    @estebanmurcia8451 Месяц назад +1

    6:42 guilty as charged

  • @djordje1999
    @djordje1999 Месяц назад

    Why not just store unix timestamp?

    • @HolgerJakobs
      @HolgerJakobs Месяц назад

      1. Who can read and write them?
      2. Unix timestamps are by defintion UTC.
      Let PostgreSQL do the work for you. Having each session set to the timestamp the person is residing in, everybody will be fine naively handling all timestamps.

  • @prashlovessamosa
    @prashlovessamosa Месяц назад

    Your background is too good.

  • @luca4479
    @luca4479 Месяц назад

    What kind of camera do you use to film your videos? Your camera quality is on par with MKBHD and LTT, I’m in awe!

  • @dalcod
    @dalcod Месяц назад

    October 15 is too far for me lol.

  • @saryakan
    @saryakan Месяц назад +7

    Best tip on handling time zones?
    Don't.

    • @HolgerJakobs
      @HolgerJakobs Месяц назад

      Exactly. Let PostgreSQL do this for you. The PostgreSQL Global Developer Group are more of experts than you (and I) are.

  • @codedusting
    @codedusting Месяц назад +2

    Timezones of all things should have been a physics problem, not politics. How did that even happen?

    • @aarondfrancis
      @aarondfrancis  Месяц назад +4

      Geeze, I dunno. It sucks though

    • @codedusting
      @codedusting Месяц назад +1

      @@aarondfrancis yes. I had to make a real estate auction site for Dubai UAE but international buyers. It was quite hell back in 2020.

    • @melvillespence6768
      @melvillespence6768 Месяц назад +1

      Where do you set the origin? Greenwich was chosen in 1884 at the Meridian Conference, when the UK was the preeminent power. GMT was adopted within the UK in 1847 because of the railways. BST came in WW1 to make best use of the working day, in WW2 we had double summer time for the same reason. In an ideal world we would use 15 degrees of longitude = 1 hour, but 🤣

    • @HolgerJakobs
      @HolgerJakobs Месяц назад

      Who has the power to determine? And clearly, it's a good idea to have a single time zone in at least most countries. Only a few countries stretch so far east-west that several time zones are necessary. Having physics strictly determining the time zone would mean that most countries (except the very small ones) have several time zones, which would not come in handy.
      We have the same time zone in a lot of countries: Norway, Sweden, Denmark, Poland, Czech Republic, Slovakia, Slovenia, Germany, Austria, Italy, Switzerland, France, Luxemburg, Netherlands, Belgium, Andorra, Spain.

  • @jrdnrc
    @jrdnrc Месяц назад

    thanks i hate timezones

    • @HolgerJakobs
      @HolgerJakobs Месяц назад

      No need do. Let PostgreSQL handle everything for you and you'll be fine. Just make sure that every session has the time zone set to the place where the person resides running it.

  • @kirayamato6128
    @kirayamato6128 Месяц назад

    Aaron ❤️🧡💛💚🩵💙💜🤎🖤🩶🤍🩷