Convert UTC datetime object to epoch seconds

A timedelta object represents a duration, the difference between two dates or times.

Convert UTC time to PST time in python

I wrote a small function which converts a datetime object from a timezone to a new timezone.
file name :

In action:

You can see all available time zones using pytz.all_timezones

How to convert an epoch second to a python datetime object?

The Epoch second (POSIX time/Unix time) is the number of seconds that have elapsed since January 1, 1970. Epoch seconds are not counting leap seconds.

So how we can convert an epoch second to human readable time?

For that, first we need to create a datetime object for the day 1970/Jan/01

then put the epoch second which you would like to convert to a human readble format in a varaible

then create a timedelta object for the epoch_second

then add dobj1 to dobj2

or in short

How to make google drive as your automated backup location using python

Before you going to coming paragraphs of this article, I recommend you to watch following youtube video so you will get what is going to describe here:

Read following links to learn more about the authentication mechanism google API is using :

As Claudio (GOOGLE) mentioned in the above video, (, we need to use some logic (client library) to sort your crendentials for reusing. Other wise on every execution of ‘’ script, you need human interaction for getting tokens. I added 6 lines to google’s ‘’ to keep authorization code for reusing. So as long as the user has not revoked the access granted initially to the application, you don’t need a human interaction.

For more details :

You can get modified google’s using following


Goto :

So, you got the idea how to deal with Google API and authentication to Google drive without human interaction. Now, you just need to apply your modifications to the script, suitable to your environment and then just put a cron job.