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

I am newbie in odoo 8 , I add a date field entry and exit date and how to calculate the date of entry and exit dates

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

Mr.achuthan I am still confused with answer , Mr.achuthan could give a few examples of the answers above

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

You use normal python library to do date calculation.  There are many python datetime libraries out there, but I would recommend that you use datetime with some improvement from dateutil if necessary.
 

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

d_frm_obj = datetime.strptime(entry_date, DEFAULT_SERVER_DATETIME_FORMAT)
d_to_obj = datetime.strptime(exit date, DEFAULT_SERVER_DATETIME_FORMAT)
diff = d_to_obj - d_frm_obj
print diff.days  //provides days

https://www.odoo.com/forum/help-1/question/how-to-find-out-number-of-hours-between-two-datetime-object-69367#answer-69386

Ảnh đại diện
Huỷ bỏ