public function readUNBDateTimeOfPreperation()
{
//separate date (YYMMDD) and time (HHMM)
$date = $this->readEdiDataValue('UNB', 4, 0);
if (!empty($date)) {
$time = $this->readEdiDataValue('UNB', 4, 1);
$datetime = preg_replace('#(\\d\\d)(\\d\\d)(\\d\\d)(\\d\\d)(\\d\\d)#', '20$1-$2-$3 $4:$5:00', $date . $time);
return $datetime;
}
//common YYYYMMDDHHMM
$datetime = $this->readEdiDataValue('UNB', 4);
$datetime = preg_replace('#(\\d\\d\\d\\d)(\\d\\d)(\\d\\d)(\\d\\d)(\\d\\d)#', '$1-$2-$3 $4:$5:00', $datetime);
return $datetime;
}