<?php
 class datetimeField extends baseField { var $Conf = array( 'xtype' => 'datetimefield', 'editable' => false, 'icon' => 'time.png', ); function edit($addConf,$R) { $R['hiddenFormat'] = 'Y-m-d-H-i-s'; $R['dateFormat'] = 'd.m.Y'; $R['timeFormat'] = 'G:i'; if(!$R['value'] AND $addConf['attr']['defaultValueToday']) { $R['value'] = mktime(); } if($R['value']) { $R['value'] = date($R['hiddenFormat'],$R['value']); } return parent::edit($addConf,$R); } function getSetValue($v) { if($v) { $tmp = explode('-',$v); $v = mktime($tmp[3],$tmp[4],$tmp[5],$tmp[1],$tmp[2],$tmp[0]); } return $v; } function getGetValue($v) { if(!$v) return ''; return date('d.m.Y H:i:s',$v); } } ?>