Odoo Help

1

How to change point of sale date format?

By
JC
on 1/26/15, 6:20 PM 1,125 views

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 />

2
Shawn Varghese
On 1/29/15, 4:24 AM

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.

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.

Register

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

1 follower(s)

Stats

Asked: 1/26/15, 6:20 PM
Seen: 1125 times
Last updated: 12/10/15, 11:07 PM