Skip to content

Commit 5241cce

Browse files
committed
Improved date parsing routine in tform library to add support for different date formats.
1 parent 10f8386 commit 5241cce

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

interface/lib/classes/tform.inc.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -620,8 +620,9 @@ function encode($record,$tab) {
620620
break;
621621
case 'DATE':
622622
if($record[$key] != '' && $record[$key] != '0000-00-00') {
623-
list($tag,$monat,$jahr) = explode('.',$record[$key]);
624-
$new_record[$key] = $jahr.'-'.$monat.'-'.$tag;
623+
$date_parts = date_parse_from_format($this->dateformat,$record[$key]);
624+
//list($tag,$monat,$jahr) = explode('.',$record[$key]);
625+
$new_record[$key] = $date_parts['year'].'-'.$date_parts['month'].'-'.$date_parts['day'];
625626
//$tmp = strptime($record[$key],$this->dateformat);
626627
//$new_record[$key] = ($tmp['tm_year']+1900).'-'.($tmp['tm_mon']+1).'-'.$tmp['tm_mday'];
627628
} else {

0 commit comments

Comments
 (0)