<?phpclass tarih_tr{function gun_tr($gun){switch($gun){case 0 : $gun = "Pazar";break;case 1 : $gun = "Pazartesi";break;case 2 : $gun = "Salı";break;case 3 : $gun = "Çarşamba";break;case 4 : $gun = "Perşembe";break;case 5 : $gun = "Cuma";break;case 6 : $gun = "Cumartesi";break;}return $gun;}function ay_tr($ay){switch($ay){case 1 : $ay = "Ocak";break;case 2 : $ay = "Şubat";break;case 3 : $ay = "Mart";break;case 4 : $ay = "Nisan";break;case 5 : $ay = "Mayıs";break;case 6 : $ay = "Haziran";break;case 7 : $ay = "Temmuz";break;case 8 : $ay = "Ağustos";break;case 9 : $ay = "Eylül";break;case 10 : $ay = "Ekim";break;case 11 : $ay = "Kasım";break;case 12 : $ay = "Aralık";break;}return $ay;}function hazirla($stil){if(empty($stil) or $stil>4 or $stil<1){$stil = 4;}if($stil==1){$veri = date("d")."/".date("m")."/".date("y");}elseif($stil==2){$veri = date("d")."/".date("m")."/".date("Y");}elseif($stil==3){$veri = date("d")."/".date("m")."/".date("Y")." ".$this->gun_tr(date("w"));}elseif($stil==4){$veri = date("d")." ".$this->ay_tr(date("n"))." ".date("Y")." ".$this->gun_tr(date("w"));}return $veri;}}$dt = new tarih_tr;echo $dt->hazirla(1);echo "<br>";echo $dt->hazirla(2);echo "<br>";echo $dt->hazirla(3);echo "<br>";echo $dt->hazirla(4);?>
Çıktısı
30/05/1830/05/201830/05/2018 Çarşamba30 Mayıs 2018 Çarşamba