user3808789 user3808789 -4 years ago 98
MySQL Question

how to convert date format in my sql after `where`

$result = mysqli_query(Db::$link,"
select *
from `ka_fatora`
where DATE_format(`date`,'Y')='2017'
");


date =
i want to select value after confert it to (Y)//
y : year
the value in database as 1485921351

Answer Source

Try Below MySQLi Query

$result = mysqli_query(Db::$link,"
    SELECT * FROM `ka_fatora`
    WHERE DATE_FORMAT(FROM_UNIXTIME(date), "%Y")='2017'
");
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download