Python 3 Datetime Library Script to Convert Current Date Time to Timezone Full Project For Beginners

Python 3 Datetime Library Script to Convert Current Date Time to Timezone Full Project For Beginners

 

Welcome folks today in this blog post we will be converting current date and time to timezone in python using datetime library. All the full source code of the application is shown below.

 

 

Get Started

 

 

In order to get started you need to make an app.py file and copy paste the following code

See also  Python 3 Script to Implement Multithreading and Writing Background Files in Python Full Tutorial For Beginners

 

app.py

 

from datetime import datetime

# current date and time
now = datetime.now()

timestamp = datetime.timestamp(now)
print("timestamp =", timestamp)

 

 

Now if you execute the above python script by typing the below command as shown below

 

python app.py

 

Leave a Reply