In our application we use a default of UTC as the timezone and in the database as well, like so:

        connect_info => [
                ...
                {on_connect_do=>['SET time_zone = "GMT"']},
        ],

But retrieving the date is cumbersome:

        sub row2hash {
                ...
                $cols->{$_} = $row->$_->set_time_zone('GMT')
                        if ref $row->$_ eq 'DateTime';
                ...
        }

This could be simplified if we could specify a default time zone which is by default set to 'floating' for the DateTime::Format::MySQL module:

        use Date::Format::MySQL;

        Date::Format::MySQL::set_default_timezone('GMT');

and in DateTime::Format::MySQL:

        our $TIMEZONE = 'floating';
        sub set_default_timezone { $TIMEZONE = $_[0]; }

and replace 'floating' with $TIMEZONE everywhere.

Regards,

Nick
AnyWi Technologies

Reply via email to