Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
1 Trả lời
9168 Lượt xem

The date in my Invoice is currently showing as:
    21/11/2014 16:59:15
I want to show just month something like this:

11  
I tried using t-esc with strftime but that doesn't work:
    <span t-esc="o.date_order.strftime('%m')" />

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

Hello

You can use as below:

<span t-esc="datetime.datetime.strptime(o.date_order, '%Y-%m-%d').strftime('%m')"/>

Note: Date format must match with the format of the date_order.

Thanks

Ảnh đại diện
Huỷ bỏ

Thank you, Sudhir Sir.

+1 from me.

thanks

Bài viết liên quan Trả lời Lượt xem Hoạt động
1
thg 3 17
3237
2
thg 2 24
5381
2
thg 9 24
1918
2
thg 7 23
6301
1
thg 6 23
4323