I created one salary rule for seniority(antiquity: Number of days the employee has done in company)
i have the join date (from contract) and today of the employee..
what i want is how many days between that two date.
ie: number of working days between two dates
Please help me.
Using below code you will get number of days.
from datetime import datetime
format = '%Y-%m-%d'
start_date = '2015-12-01' -> Take your date field1
end_date = '2015-12-31' -> Take your date field2
start = datetime.strptime(start_date, format)
end = datetime.strptime(end_date, format)
daysDiff = str((end-start).days) -> will gives you 30 days
daysDiff = str((end-start).days + 1) -> will gives you 31 days
Hope this code help for you !!!
Thanks & Regards,
Ankit H Gandhi.
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
|Asked: 12/1/15, 3:43 AM|
|Seen: 456 times|
|Last updated: 12/1/15, 6:30 AM|