35 public function __construct($sDate=null,$sFormat=
'Y-m-d h:i:s'){
51 list($sYear,$sMonth,$sDay,$sHour,$sMinute,$sSecond)=$this->convertFromFormatToTab($sDate,$sFormat);
73 $this->iJoursemaine=null;
85 return sprintf(
'%02d',$this->iHour);
92 return sprintf(
'%02d',$this->iMinute);
99 return sprintf(
'%02d',$this->iSecond);
107 $this->iHour=(int)$iHour;
114 $this->iMinute=(int)$iMinute;
121 $this->iSecond=(int)$iSecond;
130 return date($sFormat,$this->
getMkTime());
138 return mktime($this->iHour,$this->iMinute,$this->iSecond,$this->iMonth,$this->iDay,$this->iYear);
141 private function convertFromFormatToTab($sDate,$sFormat){
147 if($sFormat==
'Y-m-d'){
148 list($iAnnee,$iMois,$iJour)=explode(
'-',$sDate);
149 }elseif($sFormat==
'd-m-Y'){
150 list($iJour,$iMois,$iAnnee)=explode(
'-',$sDate);
151 }elseif($sFormat==
'd/m/Y'){
152 list($iJour,$iMois,$iAnnee)=explode(
'/',$sDate);
153 }elseif($sFormat==
'Y/m/d'){
154 list($iAnnee,$iMois,$iJour)=explode(
'/',$sDate);
155 }elseif($sFormat==
'm-d-Y'){
156 list($iMois,$iJour,$iAnnee)=explode(
'-',$sDate);
157 }elseif($sFormat==
'y-m-d'){
158 list($iAnnee,$iMois,$iJour)=explode(
'-',$sDate);
159 $iAnnee=2000+intval($iAnnee);
160 }elseif($sFormat==
'Y-m-d h:i:s'){
161 $tDatetime=preg_split(
'/\s/',$sDate);
162 list($iAnnee,$iMois,$iJour)=explode(
'-',$tDatetime[0]);
163 list($iHeure,$iMinute,$iSeconde)=explode(
':',$tDatetime[1]);
168 sprintf(
'%04d',$iAnnee),
169 sprintf(
'%02d',$iMois),
170 sprintf(
'%02d',$iJour),
171 sprintf(
'%02d',$iHeure),
172 sprintf(
'%02d',$iMinute),
173 sprintf(
'%02d',$iSeconde),
__construct($sDate=null, $sFormat='Y-m-d h:i:s')
loadFromFormat($sDate, $sFormat)
toString($sFormat='Y-m-d H:i:s')