I reply to all queries on the forums and via email, once per day, Monday to Friday (not weekends).

If you are new here, please see some information on how to ask for support. Thank you!

Reply To: Timezones of Moves

dashed-slug.net Forums General discussion Timezones of Moves Reply To: Timezones of Moves

#6266
alexg
Keymaster

Hello,

If your database version is earlier than 5.6, then CONVERT_TZ() will not work and you can use DATE_SUB() or some other method. I believe you should remove some extra characters from your query, so rewrite your code like so:

$sql3 = "SELECT COUNT(*) FROM $walletTable WHERE DATE_SUB(created_time, INTERVAL 6 HOUR) >='$fromDate' AND DATE_SUB(created_time, INTERVAL 6 HOUR)<='$endDate' AND account='$account' AND category='move' ";

If you don’t trust your inputs, you should use $wpdb->prepare() instead of relying on PHP string interpolation to insert the variable values. But if you are in control the inputs it should not matter.

with regards