简体   繁体   English

如何使用Google日历api python找到两个事件之间的时差

[英]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. 我正在尝试创建一个程序,在我上班时检查我的Google日历,以及是加班还是正常费率,然后计算我应该为该月支付的金额。 I have read over the Google API reference but I have had no luck. 我已经阅读了Google API参考资料,但我没有运气。 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 使用Timedelta可以在Python中计算两个日期之间的差异

Of course this has nothing to do with Google API. 当然,这与Google API无关。 Maybe you should have asked a more specific question. 也许你应该问一个更具体的问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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