Skip ke Konten
Menu
Pertanyaan ini telah diberikan tanda
1 Balas
6392 Tampilan

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

Avatar
Buang
Jawaban Terbai

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.

Avatar
Buang
Post Terkait Replies Tampilan Aktivitas
1
Apr 23
4069
1
Mei 19
3142
1
Mei 18
5143
0
Jan 16
4665
2
Agu 15
4835