Changeset 3118 for branches/2.0/include
- Timestamp:
- Jan 31, 2009, 2:12:20 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2.0/include/functions.inc.php
r3046 r3118 579 579 global $lang; 580 580 581 list($year,$month,$day,$hour,$minute,$second) = array(0,0,0,0,0,0); 582 583 switch ( $type ) 584 { 585 case 'us' : 586 { 587 list($year,$month,$day) = explode('-', $date); 588 break; 589 } 590 case 'unix' : 591 { 592 list($year,$month,$day,$hour,$minute) = 593 explode('.', date('Y.n.j.G.i', $date)); 594 break; 595 } 596 case 'mysql_datetime' : 597 { 598 preg_match('/^(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})$/', 599 $date, $out); 600 list($year,$month,$day,$hour,$minute,$second) = 601 array($out[1],$out[2],$out[3],$out[4],$out[5],$out[6]); 602 break; 603 } 604 case 'mysql_date' : 605 { 606 preg_match('/^(\d{4})-(\d{2})-(\d{2})$/', 607 $date, $out); 608 list($year,$month,$day) = 609 array($out[1],$out[2],$out[3]); 610 break; 611 } 612 } 581 $ymdhms = array(); 582 $tok = strtok( $date, '- :'); 583 while ($tok !== false) 584 { 585 $ymdhms[] = $tok; 586 $tok = strtok('- :'); 587 } 588 589 if ( count($ymdhms)<3 ) 590 { 591 return false; 592 } 593 613 594 $formated_date = ''; 614 595 // before 1970, Microsoft Windows can't mktime 615 if ($y ear>= 1970)596 if ($ymdhms[0] >= 1970) 616 597 { 617 598 // we ask midday because Windows think it's prior to midnight with a 618 599 // zero and refuse to work 619 $formated_date.= $lang['day'][date('w', mktime(12,0,0,$month,$day,$year))]; 620 } 621 $formated_date.= ' '.$day; 622 $formated_date.= ' '.$lang['month'][(int)$month]; 623 $formated_date.= ' '.$year; 624 if ($show_time) 625 { 626 $formated_date.= ' '.$hour.':'.$minute; 627 } 628 600 $formated_date.= $lang['day'][date('w', mktime(12,0,0,$ymdhms[1],$ymdhms[2],$ymdhms[0]))]; 601 } 602 $formated_date.= ' '.$ymdhms[2]; 603 $formated_date.= ' '.$lang['month'][(int)$ymdhms[1]]; 604 $formated_date.= ' '.$ymdhms[0]; 605 if ($show_time and count($ymdhms)>=5 ) 606 { 607 $formated_date.= ' '.$ymdhms[3].':'.$ymdhms[4]; 608 } 629 609 return $formated_date; 630 610 }
Note: See TracChangeset
for help on using the changeset viewer.