I have a working DBIx::Class resultset which looks roughly like this:
my $tasks_to_do = $self->search( { -and => [ scheduled_run_time => { '<= +', 'NOW()'}, status => 'pending' ] } );
But I need that "NOW()" to be in Sydney, Australia time, not the server time which is UTC.
In the script which calls this ResultSet method I've got both
BEGIN { $ENV{TZ} = 'Australia/Sydney'; }
and
$schema->storage->dbh_do(sub {"SET TIMEZONE='Australia/Sydney'"} );
But it still returns no records.
Due diligence: I know there are records because if I go in to the db manually and do this:
sessions=> SET TIMEZONE='UTC'; SET sessions=> select * from mytable where scheduled_run_time <= NOW() and + status = 'pending';
I get "no rows", but if I do this:
sessions=> SET TIMEZONE='Australia/Sydney'; SET sessions=> select * from mytable where scheduled_run_time <= NOW() and + status = 'pending';
I get the expected number of records.
TIA. I have had my coffee by the way.
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |