How to convert a string to a datetime?
I'm trying to run a row query with objects. I have a tran_date field which is look like: '2022062519:14:47' I think because of that I'm getting this error:
django.db.utils.DataError: date/time field value out of range: "2022062519:22:54" LINE 1: ...HERE merch_id = '510000022048730' and tran_date = '202206251...
Here is my code:
medium_prob = ProcessTransaction.objects.raw('SELECT * '
'FROM bvb_generaltransaction '
'WHERE merch_id = %s and tran_date = %s::DATE '
'and probabilty >= 0.8 and alerted= false',
[str(merchant.merch_id), str(merchant.tran_date)])
How can I solve that?