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

In the pos.xml file,  how do I change the date format  to display dd/mm/yyyy ?


    <t t-name="PosTicket">
        <div class="pos-sale-ticket">
            
            <div class="pos-center-align"><t t-esc="new Date().toString(Date.CultureInfo.formatPatterns.shortDate + ' ' +
                Date.CultureInfo.formatPatterns.longTime)"/> <t t-esc="order.get('name')"/></div>
            <br />

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

Try this:

<t t-esc="new Date().getDate()+'/'+new Date().getMonth()+1+'/'+new Date().getFullYear()"/>

It's not an elegant way to do it, but seeing as no one else has answered, I thought I'll comment.

I have added +1 to the month because JavaScript starts months from 0-11.

I would recommmend you to test it with different dates to make sure it does not break.

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
1
thg 4 23
3853
1
thg 5 19
2919
1
thg 5 18
5039
0
thg 1 16
4501
2
thg 8 15
4751