Changeset 442 for trunk/Common/Types/Date.php
- Timestamp:
- Oct 14, 2012, 9:27:26 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Common/Types/Date.php
r428 r442 11 11 global $MonthNames; 12 12 13 $Parts = explode('-', $Item['Value']); 13 if(strtolower($Item['Value']) == 'now') $Item['Value'] = time(); 14 $Parts = getdate($Item['Value']); 14 15 15 $Output = ($Parts[2] * 1).'.'.$MonthNames[$Parts[1] * 1].' '.$Parts[0];16 $Output = $Parts['mday'].'. '.$MonthNames[$Parts['mon']].' '.$Parts['year']; 16 17 return($Output); 17 18 } … … 20 21 { 21 22 global $MonthNames; 22 23 $Parts = explode('-', $Item['Value']); 23 24 if(strtolower($Item['Value']) == 'now') $Item['Value'] = time(); 25 $Parts = getdate($Item['Value']); 24 26 25 27 // Day … … 27 29 for($I = 1; $I <= 31; $I++) 28 30 { 29 if($Parts[ 2] == $I) $Selected = ' selected="1"'; else $Selected = '';31 if($Parts['mday'] == $I) $Selected = ' selected="1"'; else $Selected = ''; 30 32 $Output .= '<option value="'.$I.'"'.$Selected.'>'.$I.'</option>'; 31 33 } … … 35 37 for($I = 1; $I <= 12; $I++) 36 38 { 37 if($Parts[ 1] == $I) $Selected = ' selected="1"'; else $Selected = '';39 if($Parts['mon'] == $I) $Selected = ' selected="1"'; else $Selected = ''; 38 40 $Output .= '<option value="'.$I.'"'.$Selected.'>'.$MonthNames[$I].'</option>'; 39 41 } … … 43 45 for($I = 1900; $I < 2100; $I++) 44 46 { 45 if($Parts[ 0] == $I) $Selected = ' selected="1"'; else $Selected = '';47 if($Parts['year'] == $I) $Selected = ' selected="1"'; else $Selected = ''; 46 48 $Output .= '<option value="'.$I.'"'.$Selected.'>'.$I.'</option>'; 47 49 } … … 52 54 function OnLoad($Item) 53 55 { 54 return($_POST[$Item['Name'].'-year'].'-'.$_POST[$Item['Name'].'-month'].'-'.$_POST[$Item['Name'].'-day']); 56 return(mktime(0, 0, 0, $_POST[$Item['Name'].'-month'], $_POST[$Item['Name'].'-day'], $_POST[$Item['Name'].'-year'])); 57 } 58 59 function OnLoadDb($Item) 60 { 61 return(MysqlDateToTime($Item['Value'])); 62 } 63 64 function OnSaveDb($Item) 65 { 66 return(date('Y-m-d', $Item['Value'])); 55 67 } 56 68
Note:
See TracChangeset
for help on using the changeset viewer.