-1
これは私のデータです。以下のようにPerl:日付差と平均日を計算する
Ticket Submitted_date Ticket closed_date
2017-05-11 12:47:08.2 2017-05-26 07:00:16.0
2017-05-11 13:23:10.96 2017-05-27 22:01:02.0
2017-05-11 13:23:02.483 2017-05-24 08:10:20.0
2017-05-11 13:28:35.247 2017-05-24 08:12:33.0
コード、
use strict;
use warnings;
my $qstr = "select id as 'id', status as 'status', $subject.title as 'title', $subject.component as 'component', $subject.submitted_date as 'submitted_date', $subject.closed_date as 'closed_date' where ($subject.status = 'complete' OR $subject.status = 'rejected')";
my $results = &search($api, $tenant, $subject, $qstr);
foreach my $singleRow (@$results) {
my $title =$singleRow->{'title'};
my $component = $singleRow->{'component'};
my $sub_date = $singleRow->{'submitted_date'};
my $closed_date = $singleRow->{'closed_date'};
$sub_date =~ /^(.{4})-(.{2})-(.{2})T(.{2}):(.{2}):(.{2})\.(.{3})/;
上記のデータの平均日数を計算する方法には何のアイデア。 はPerlのに援助...新が必要...
「_average days_」はどういう意味ですか? – zdim
1.変数/行から日付を抽出します( 'split'またはregexまたは両方を使用して)2.好きな日付/時刻のモジュールを探します。簡単な選択は[DateTime](http://search.cpan.org/~drolsky/DateTime-1.43/lib/DateTime.pm)ですが、確かに他のものがあります。彼らのほとんどはあなたが必要とするもののためにいくつかの施設を持っています。 3.モジュールが望む形式で日付/時刻を入れてください – zdim
日時は非常に標準的な形式であり、多くのモジュールがそれを理解しているので、解析する必要はありません(一度データの行から取得するとあなたが見せている) – zdim