问题是这样的:
有个字段是submit_date,当该记录关闭的时候,取当前时间,并与submit_date时间进行计算,取二者之间的差值。
代码如下:
my $currenttime;
my $submittime;
my $result;
$currenttime = GetCurrentDate();
$submittime = $entity->GetFieldValue("submit_date");
$result = $currenttime - $submittime;
$entity->SetFieldValue("defect_lifecycle", $result);
defect_lifecycle是short_string类型的,最后两句代码有问题,希望大家帮忙看看如何解决。
在vb中这个问题很好解决,因为vb有DateDiff方法,而perl好像没有。