Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
2 ตอบกลับ
6559 มุมมอง

Hello everyone,

I have a datetime field and i want to format it to hours, minutes, seconds in the form view.

Is this posible, and how to do it?

Thanks.

Note: I'm not wanna do this for all datetime field on the website, i just wanna make this for that field only.

อวตาร
ละทิ้ง

in which format you want it ?

ผู้เขียน

what do you mean in which format? i wanna make it in FORM VIEW in case this is the answer you looking for.

ผู้เขียน คำตอบที่ดีที่สุด

As far as i can research, we can use this as alternative solution:


1. Change the field from `Datetime` to `Float`:
your_field = fields.Float(string='Your Field')


2. Then, in the form view, add `widget="float_time"`:


With this, there's no popup to show (It's bad, i know).

But as i mentioned before, this solution is just a alternative solution until we find better solution.

Other answers are welcome.


Note for the report view or email view, we can use this: 

t-options="{'widget': 'float_time'}"


Thanks.



อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

Hi,

If you need to change the date time format everywhere inside the database, you can change it from language.

See: https://www.youtube.com/watch?v=Cl6DiqJnM8M

Thanks

อวตาร
ละทิ้ง
ผู้เขียน

Sorry but I'm not wanna do this for all datetime field on the website, i just wanna make this for that field only.

Related Posts ตอบกลับ มุมมอง กิจกรรม
2
ก.ค. 22
2001
1
ม.ค. 23
2020
1
ก.พ. 22
2647
3
มิ.ย. 25
845
1
มิ.ย. 25
1592