Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ValueError: unconverted data remains: 00:00:00

Tags:

python

odoo

I have problem in convert date time.

Here is my code:

@api.multi
def action_confirm(self):
if picking.state not in ['cancel', 'draft']:
    for schedule_delivery in sorted_key:

    print "line 105: ", schedule_delivery
                dup_picking = picking.copy()
                        if shift == "afternoon":
                            date_object = datetime.strptime(schedule_delivery, '%Y-%m-%d')
                            print "Line 146", date_object
                            # raise EnvironmentError
                            tanggal = datetime.strftime(date_object, "%Y-%m-%d") + ' 06:00:00'
                            print "Line 145", tanggal
                            dup_picking.min_date = tanggal
                        else:
                            dup_picking.min_date = schedule_delivery

Error:

    date_object = datetime.strptime(schedule_delivery, '%Y-%m-%d')
  File "/usr/lib/python2.7/_strptime.py", line 328, in _strptime
    data_string[found.end():])
ValueError: unconverted data remains:  00:00:00
like image 794
Ftr Avatar asked Jul 26 '26 19:07

Ftr


1 Answers

You can use this line of code-

date_object = datetime.strptime(str(schedule_delivery), '%Y-%m-%d %H:%M:%S')
like image 81
GauravInno Avatar answered Jul 29 '26 08:07

GauravInno



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!