Tips for handling timezones in Postgres

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

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

  • @mehdi_sadeghi
    @mehdi_sadeghi 3 месяца назад +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!

  • @awksedgreep
    @awksedgreep 27 дней назад

    Great video! DBA of over 1400 databases and the most successful groups I support stopped the video at 2:26. ;)

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

    These videos are the best. Keep pumping this content Aaron

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

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

  • @Voltra_
    @Voltra_ 3 месяца назад +1

    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)

  • @CodingWithTaaxo
    @CodingWithTaaxo 3 месяца назад +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  3 месяца назад +1

      Oh nice, added to my list!

    • @dalcod
      @dalcod 3 месяца назад

      That is a good suggestion.

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

    aaron is the godfather

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

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

  • @coffeeowl86
    @coffeeowl86 3 месяца назад

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

  • @fabriai
    @fabriai 2 месяца назад

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

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

    full course hype

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

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

  • @hectoreduardosolanopestana6964
    @hectoreduardosolanopestana6964 3 месяца назад

    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!

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

    What client are you using?

  • @HashimWarren
    @HashimWarren 3 месяца назад

    Is the course project based? Looking forward to it

  • @nolocobralink
    @nolocobralink 3 месяца назад

    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)

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

    Since when did you use Postgres

  • @jricardoprog
    @jricardoprog 3 месяца назад

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

    • @HolgerJakobs
      @HolgerJakobs 2 месяца назад

      Can you provide an example?

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

    8:30 base because Docker haha

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

      haha I dont know what I was thinking

  • @djordje1999
    @djordje1999 3 месяца назад

    Why not just store unix timestamp?

    • @HolgerJakobs
      @HolgerJakobs 2 месяца назад

      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.

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

    Time stone 😄

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

    6:42 guilty as charged

  • @prashlovessamosa
    @prashlovessamosa 2 месяца назад

    Your background is too good.

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

    Best tip on handling time zones?
    Don't.

    • @HolgerJakobs
      @HolgerJakobs 2 месяца назад

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

  • @luca4479
    @luca4479 3 месяца назад

    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 3 месяца назад

    October 15 is too far for me lol.

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

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

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

      Geeze, I dunno. It sucks though

    • @codedusting
      @codedusting 3 месяца назад +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 3 месяца назад +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 2 месяца назад

      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 3 месяца назад

    thanks i hate timezones

    • @HolgerJakobs
      @HolgerJakobs 2 месяца назад

      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 3 месяца назад

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