1

odoo ERP regroup by day as default :

data[k] = babel.dates.format_date(v, format="dd MMM yyyy", locale=context.get('lang', 'en_US')).

what i want to do is to change the format date from day to hour format.

I try to change the previous code line:

data[k] = babel.dates.format_date(v, format="HH dd MMM yyyy", locale=context.get('lang', 'en_US'))

but this return an error:

 AttributeError: 'datetime.date' object has no attribute 'hour'

TO clarify i want to create custom date/time pattern, in which the hour must appear.

desertnaut
  • 57,590
  • 26
  • 140
  • 166
Yacino
  • 645
  • 2
  • 10
  • 32

1 Answers1

1

You may need datetime object for hour not just date. try

babel.dates.format_datetime

See: http://babel.pocoo.org/docs/api/dates/

sagarchalise
  • 992
  • 8
  • 14