Odoo Help


How can I format date in Odoo 8 QWeb report?

César Bustíos Benites
on 11/21/14, 10:54 AM 23,791 views

The date in my Sales Order is currently showing as:

Fecha: 21/11/2014 16:59:15

I want to show something like this:

Fecha: Surco, 21 de Noviembre del 2014

I tried using t-esc with strftime but that doesn't work:

<span t-esc="o.date_order.strftime('%Y')" />


Ankit H Gandhi(AHG)

--Ankit H Gandhi(AHG)--

| 6 5 6
Baroda, India
--Ankit H Gandhi(AHG)--

Learning Python..

Ankit H Gandhi(AHG)
On 1/23/15, 2:12 AM

Hello Cesar Bustios Benites

try this code may be helpfull.

<span t-field="o.date_order" t-field-options='{"format": "d MMMM y"}'/>

also use this code

<span t-field="o.date_order" t-field-options="{&quot;format&quot;: &quot;yyyy-MM-dd&quot;}" />


I thought that t-field-options could only be applied to t-field.

<span t-field="o.commencement_date"

t-field-options="{&quot;format&quot;: &quot;dd/MM/yy&quot;}"></span


<span t-esc="o.order_date" t-options='{"widget": "date"}'/>

if you find this answer helpful, please give me a thumbs up vote


Ankit H Gandhi


Sajin Aziz
On 11/22/14, 3:50 AM

try this , change date format as required , refer: Python Standard Library - time , 

<span t-esc="time.strftime(''%A, %d %B %Y'',time.strptime(o.date_order,'%Y-%m-%d %H:%M:%S'))"/>

Thank you @Sajin, I'm getting "Uncaught SyntaxError: Unexpected end of input"

César Bustíos Benites
on 11/24/14, 10:10 AM

Sorry, my bad. This is the correct answer :-)

César Bustíos Benites
on 11/24/14, 10:12 AM

Although I'm using Spanish as my language, I'm getting this: "Surco, 21 de November del 2014". How can I make months show in Spanish?

César Bustíos Benites
on 11/24/14, 10:15 AM
acha aslam
On 6/29/17, 2:08 AM

in odoo10

it prints mm-dd-yyyy format of date order

<span t-field="o.date_order" t-options="{&quot;format&quot;: &quot;MM-dd-yyyy&quot;}" />

Kelly Stuart
On 11/22/14, 3:09 AM

Hi César. If you are getting an error, please specify what error it is. Otherwise I'm going to assume that your date format is merely incomplete. Try this:

<span t-esc="o.date_order.strftime('%A, %d de %B del %Y')" />

Hello @Kelly, thank you for your answer. Yes I'm getting an error: "Uncaught SyntaxError: Unexpected end of input"

César Bustíos Benites
on 11/24/14, 10:07 AM
Ubaid ur Rehman
On 6/21/17, 6:02 AM

For date and time display in formate like Jun 20, 2017 11:05 AM in Qweb Report.
"<sapn t-esc="datetime.datetime.strptime(o.create_date, '%Y-%m-%d %H:%M:%S').strftime('%b %d,%Y %H:%M %p')"/>"


model inside default field date

current_date = fields.Date(default=time.strftime("%Y-%m-%d"))

report xml

<span t-field="o.start_date"/>

About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

2 follower(s)


Asked: 11/21/14, 10:54 AM
Seen: 23791 times
Last updated: 6/29/17, 2:08 AM