my $table = 'timestampt'; $dbh->do( "CREATE TABLE IF NOT EXISTS $table ( Id INT, epoch_micro BIGINT, epoch_milli BIGINT, epoch_s BIGINT )" ); my $sth = $dbh->prepare( "INSERT INTO $table ( Id, epoch_micro, epoch_milli, epoch_s ) VALUES ( ?, ?, ?, ? )" ); my $values = [ [ 1, 1387528449510009, 1387528449510, 1387528449 ], [ 2, 1387528449518239, 1387528449518, 1387528449 ], [ 3, 1387529362307977, 1387529362307, 1387529362 ], ]; for my $row ( @$values ) { $sth->execute( @$row ); } $sth = $dbh->prepare( "SELECT TO_TIMESTAMP( extract( epoch epoch_milli ))::date FROM $table" ); $sth->execute(); $sth->dump_results;