50 list($sYear,$sMonth,$sDay)=$this->convertFromFormatToTab($sDate,$sFormat);
78 $this->iYear=intval($iYear);
85 $this->iMonth=intval($iMonth);
92 $this->iDay=intval($iDay);
101 if($this->iYear==null){
return null;}
103 return substr($this->iYear,-2);
104 }
else if($sFormat==
'YYYY'){
107 throw new Exception(
'Wrong format for plugin_date::getYear()');
116 if($this->iMonth==null){
return null;}
118 return $this->iMonth;
119 }
else if($sFormat==
'MM'){
120 return sprintf(
'%02d',$this->iMonth);
122 throw new Exception(
'Wrong format for plugin_date::getMonth()');
130 if($this->iMonth==null){
return null;}
135 return $tLangueDate[
'tMoisLong'][(int)$this->
getMonth(
'M')];
136 }
else if($sFormat==
'M'){
137 return $tLangueDate[
'tMoisCourt'][(int)$this->
getMonth(
'M')];
139 throw new Exception(
'Wrong format for plugin_date::getStringMonth()');
147 if($this->iMonth==null){
return null;}
152 return $tLangueDate[
'tJourLong'][(int)$this->
getWeekDay(
'D')];
153 }
else if($sFormat==
'D'){
154 return $tLangueDate[
'tJourCourt'][(int)$this->
getWeekDay(
'D')];
156 throw new Exception(
'Wrong format for plugin_date::getStringDay()');
166 if($this->iDay==null){
return null;}
169 }
else if($sFormat==
'DD'){
170 return sprintf(
'%02d',$this->iDay);
172 throw new Exception(
'Wrong format for plugin_date::getDay()');
198 $newDate=mktime(0,0,0,$this->iMonth,$this->iDay+$iNb,$this->iYear);
208 $newDate=mktime(0,0,0,$this->iMonth+$iNb,$this->iDay,$this->iYear);
218 $newDate=mktime(0,0,0,$this->iMonth,$this->iDay,$this->iYear+$iNb);
229 $newDate=mktime(0,0,0,$this->iMonth,$this->iDay-$iNb,$this->iYear);
239 $newDate=mktime(0,0,0,$this->iMonth-$iNb,$this->iDay,$this->iYear);
249 $newDate=mktime(0,0,0,$this->iMonth,$this->iDay,$this->iYear-$iNb);
259 return mktime(0,0,0,$this->iMonth,$this->iDay,$this->iYear);
269 $iAnnee=$this->iYear;
270 $iMois=$this->iMonth;
276 if(intVal($iMois)==3 or intVal($iMois)==4 or intVal($iMois)==5){
278 $sDimanchePaques=date(
'd-m-Y',easter_date($iAnnee));
279 $tDimanchePaquesTab=explode(
'-',$sDimanchePaques);
281 $iJourDimanchePaques=$tDimanchePaquesTab[0];
282 $iMoisDimanchePaques=$tDimanchePaquesTab[1];
284 $sLundiPaques=date(
'd-m-Y',mktime(0,0,0,$iMoisDimanchePaques,$iJourDimanchePaques+1,$iAnnee));
285 $tLundiPaquesTab=explode(
'-',$sLundiPaques);
287 $iJourLundiPaques=intVal($tLundiPaquesTab[0]);
288 $iMoisLundiPaques=intVal($tLundiPaquesTab[1]);
291 $sJeudiAscension=date(
'd-m-Y',mktime(0,0,0,$iMoisDimanchePaques,$iJourDimanchePaques+39,$iAnnee));
292 $tJeudiAscensionTab=explode(
'-',$sJeudiAscension);
294 $iJourJeudiAsc=intVal($tJeudiAscensionTab[0]);
295 $iMoisJeudiAsc=intVal($tJeudiAscensionTab[1]);
298 if($iJourNewDate==6 or $iJourNewDate==0){
302 else if($iMois==12 and $iJour==25){
306 else if($iMois==1 and $iJour==1){
310 else if($iMois==5 and ($iJour==1 or $iJour==8)){
314 else if($iMois==11 and ($iJour==1 or $iJour==11)){
318 else if($iMois==7 and $iJour==14){
322 else if($iMois==8 and $iJour==15){
326 else if($iMois==$iMoisLundiPaques and $iJour==$iJourLundiPaques){
330 else if($iMois==$iMoisJeudiAsc and $iJour==$iJourJeudiAsc){
343 if($this->iYear==null or $this->iMonth==null or $this->iDay==null ){
346 if( $this->iYear < 1900 ){
349 if( $this->iMonth < 1 or $this->iMonth > 12 ){
352 if( $this->iDay < 1 or $this->iDay > 31 ){
365 return date($sFormat,$this->
getMkTime());
373 if($this->getFormat(
'Y-m-d')==date(
'Y-m-d')){
380 private function convertFromFormatToTab($sDate,$sFormat){
382 if($sFormat==
'Y-m-d'){
383 list($iAnnee,$iMois,$iJour)=explode(
'-',$sDate);
384 }elseif($sFormat==
'd-m-Y'){
385 list($iJour,$iMois,$iAnnee)=explode(
'-',$sDate);
386 }elseif($sFormat==
'd/m/Y'){
387 list($iJour,$iMois,$iAnnee)=explode(
'/',$sDate);
388 }elseif($sFormat==
'Y/m/d'){
389 list($iAnnee,$iMois,$iJour)=explode(
'/',$sDate);
390 }elseif($sFormat==
'm-d-Y'){
391 list($iMois,$iJour,$iAnnee)=explode(
'-',$sDate);
392 }elseif($sFormat==
'y-m-d'){
393 list($iAnnee,$iMois,$iJour)=explode(
'-',$sDate);
394 $iAnnee=2000+intval($iAnnee);
398 sprintf(
'%04d',$iAnnee),
399 sprintf(
'%02d',$iMois),
400 sprintf(
'%02d',$iJour),
getStringDay($sFormat='DD')
static getConfigVar($sCatAndVar, $uDefaut=null)
toString($sFormat='Y-m-d')
loadFromFormat($sDate, $sFormat)
__construct($sDate=null, $sFormat='Y-m-d')
getStringMonth($sFormat='MM')