In one of my interface,I have two dates.One is the start date and other one is the end date.In the next field I want the total no.of days/month between these two dates to be automatically generated.There is no other specification regarding the dates or the total no.of days between the two dates.How to get the total number of days between the two given dates?
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- ลูกค้าสัมพันธ์
- e-Commerce
- ระบบบัญชี
- สินค้าคงคลัง
- PoS
- Project
- MRP
คำถามนี้ถูกตั้งค่าสถานะ
1
ตอบกลับ
10600
มุมมอง
Hi Sneha,
Try this,
from datetime import datetime
date_format = "%m/%d/%Y"
a = datetime.strptime('8/18/2008', date_format)
b = datetime.strptime('9/26/2008', date_format)
delta = b - a
print delta.days # that's it
See following link
Hope it works for you
Where to give this code?What if the date is not specified as 8/18/2008 and 9/26/2008
suppose your date format is '2014-12-31', for that your date_format will be '%Y-%m-%d'
This is to be added in the .py file right?
Which names are to be given instead of 8/18/2008 and 9/26/2008 in my code?
สนุกกับการพูดคุยนี้ใช่ไหม? เข้าร่วมเลย!
สร้างบัญชีวันนี้เพื่อเพลิดเพลินไปกับฟีเจอร์พิเศษและมีส่วนร่วมกับคอมมูนิตี้ที่ยอดเยี่ยมของเรา!
ลงชื่อRelated Posts | ตอบกลับ | มุมมอง | กิจกรรม | |
---|---|---|---|---|
Project- Odoo 14
แก้ไขแล้ว
|
|
1
เม.ย. 21
|
3947 | |
|
1
มี.ค. 15
|
10911 | ||
V16 Planned Date of Tasks are invisible.
แก้ไขแล้ว
|
|
3
ต.ค. 24
|
6268 | |
|
0
เม.ย. 22
|
2669 | ||
|
5
ก.พ. 20
|
4717 |