简体   繁体   中英

How do I find the time difference between two events using the Google calender api python

I'm trying to create a program which checks my Google calender when I have been in work and whether it was overtime or normal rate and then calculate the amount I should be paid for that month. I have read over the Google API reference but I have had no luck. Here is my Pseudo code:

Get events for month
Write events to file split each value with comma
Check each event for keyword work else remove from file
For each line check amount of hours worked and append to end of line
If day = Sunday or event name = work (Overtime BH) append value to BankHolidayHours Variable
If day = Thursday or Saturday append value to ContractedHours variable
    Else write to OvertimeHours variable 
BankHolidayTotal = BankHolidayHours * BHRate
ContractedHoursTotal = ContractedHours * CHRate
OvertimeHoursTotal = OvertimeHours * OHRate
Print OvetimeHoursTotal & ContractedHoursTotal & BankHolidayTotal to screen

Any help will be much appreciated thanks.

Calculating the difference between two dates in Python can be done with Timedelta

Of course this has nothing to do with Google API. Maybe you should have asked a more specific question.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM