我有以下的SQL查詢,我想以英國(dd/mm/yyyy)格式輸出ageOnLastSeptember日期。任何人都可以告訴我如何實現這一目標?將SQL日期格式化爲英國格式
$sql="select (if(month(now()) < 9, year(now()) - 1, year(now())) - year(dob) - if(month(dob)<9, 0, 1) ) as ageOnLastSeptember,first_name,last_name,dob,school,contact_no,family_id,contact_id from members_family where contact_id = '$contact_id' ";
我嘗試以下,但它沒有采取任何行動
$sql="select date_format((if(month(now()) < 9, year(now()) - 1, year(now())) - year(dob) - if(month(dob)<9, 0, 1) ), '%d/%m/%Y') as ageOnLastSeptember,first_name,last_name,dob,school,contact_no,family_id,contact_id from members_family where contact_id = '$contact_id' ";
什麼是數據庫系統? –
now()表示mysql我認爲。 –
這是MySQL @Damien_The_Unbeliever – user2281899