in reply to How to use the right timezone in a DBIx::Class ResultSet call?

Untested; DBIx::Class::Manual::Intro. Couple other ways to do it. I would suggest that you probably really want it done in your ResultSet classes such that the TZ can be included with SQL functions at the point of running the query for individual users or locations; the best way would be to have the TZ available in a relationship otherwise you might have to resort to non-standard argument handling in the queries. This approach, obviously, sets it for all queries.

my $schema = YOUR::Schema->connect ("dbi:YourDBD:$DB_NAME", undef, undef, # credentials should never be hardcoded. { AutoCommit => 1, RaiseError => 1 }, { on_connect_do => "SET TIMEZONE='Australia/Sydney'" } );
  • Comment on Re: How to use the right timezone in a DBIx::Class ResultSet call?
  • Download Code

Replies are listed 'Best First'.
Re^2: How to use the right timezone in a DBIx::Class ResultSet call?
by LittleJack (Beadle) on Aug 11, 2022 at 22:45 UTC

    Thanks so much, sorry for the delay in replying. I will test this right away.

      No trouble. If you want to share a little more about your DB and classes, I’d take a stab at showing the ResultSet class approach.