mysql ay tarih çekme .
Selam arkadaşlar mysql tarihi gün ay ve yıl olara Bu şekilde nasıl alabilrim
örenke
(2 yıl önce)ve (2 ay önce) gibi görunmesini istiyorum saygılar
2016-07-05 17:32:21
Php
sadece mysql ile olmaz, biraz php kodları eklemelisin:
örnek:
function ZamanGoster($time){ $time = time()- $time;// to get the time since that moment $time =($time<1)?1: $time; $tokens = array (31536000=>'year',2592000=>'month',604800=>'week',86400=>'day',3600=>'hour',60=>'minute',1=>'second');foreach($tokens as $unit => $text){if($time < $unit)continue; $numberOfUnits = floor($time / $unit);return $numberOfUnits.' '.$text.(($numberOfUnits>1)?'s':'');}}
kullanımı
<?
$zaman = strtotime("2016-08-20 17:25:43");echo "eklenem zamanı ".ZamanGoster($zaman)." once";
?>
Her programcı birgün Php yi tadacaktır
2016-08-21 15:40:05