$offset = 0; sub { ($year, $month, $day, $hour24, $minute, $second) = $_[0] =~ m{\A([0-9]{4})\-(0[1-9]|1[0-2])\-(0[1-9]|[12] [0-9]|3[01])T([01][0-9]|2[0-3])\:([0-5][0-9])\:([0-5][0-9]| 60)\z}mo or Carp::croak 'cannot parse datetime. text: "'. $_[0].'", format: '."\"%FT%T\""; $epoch = timegm_nocheck($second, $minute, $hour24, $day, $month - 1, $year); $offset = $time_zone->offset($epoch); $epoch -= $offset; ($epoch, $offset); };