Assuming datetime is always in the same format: <?php $datetime="1999-10-20 23:15:30"; $date=substr($datetime, 0, 4); echo $date; ?> will output 1999.
確定! 回上一頁