I converted the SQLite line
WHERE strftime('%d%m', orders.created_at) = .......
directly to a MySQL monster:
WHERE CONCAT(CAST(DAY(orders.created_at) AS CHAR), LPAD(CAST(MONTH(orders.created_at) AS CHAR), 2, '0')) = .........
Please, help me to rewrite it to a shorter one.
STRFTIME() in SQLite is similar to DATE_FORMAT() in MySQL with reversed parameters.
Since %d
and %m
map to the same thing in both, your expression can simply be written as;
WHERE DATE_FORMAT(orders.created_at, '%d%m') = .......
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With