Odoo Help

Welcome!

This community 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.

3

Date Modification

By
Miftah
on 12/16/14, 2:19 AM 660 views

How to increase or decrease the current date (code in python file) ?

1

Atchuthan - Technical Consultant, Sodexis Inc

--Atchuthan - Technical Consultant, Sodexis Inc--
3918
| 5 3 8
Puducherry, India
--Atchuthan - Technical Consultant, Sodexis Inc--
Passionate coder in Python/Odoo(formerly known as OpenERP).

Contact me via GMail: atchuthantu@gmail.com via Skype: atchuthan_skype
via Linkedin: http://in.linkedin.com/in/atchuthantu
Atchuthan - Technical Consultant, Sodexis Inc
On 12/16/14, 2:33 AM

You could use TIMEDELTA to increase or decrease date value.

from datetime import datetime, timedelta
print (datetime.today() + timedelta(days=(1))).strftime('%Y-%m-%d')    // for next day
print (datetime.today() + timedelta(days=(-1))).strftime('%Y-%m-%d')    // for previous day

For more info: https://docs.python.org/2/library/datetime.html#timedelta-objects

2
Miftah
On 12/16/14, 2:38 AM

ok, thanks you mr. Atchuthan

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 12/16/14, 2:19 AM
Seen: 660 times
Last updated: 3/16/15, 8:10 AM