Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
22 changes: 22 additions & 0 deletions AutomationScripts/Current Time Stamps/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
## Description:
- My project works on displaying Current Time Stamps
- To create GUI Calendar Using Python, we will need to import two Python modules one for creating GUI and another to get year data.
- **Pendulum**, Pendulum is one of the libraries in python which provides easily manages complex date manipulations better than native DateTime instances. It also manages timezones.
- And for the speaking purpose, we will use **pyttsx3**.

## Procedure:
```python
import pendulum
import pyttsx3
```
- First after importing modules.
- After that we will make a function **speak()** in which we will set the rate of speaking and the type of voice.
- Then we will take input from user for which year you want to display the calendar.
- After that in code section we will first use **pendulum.now()** which will tell the current date and time of that zone.
- After displaying it, a bot voice will ask you to enter a location which is evaluated in try and except block.

## Sample Output:
![LGM](https://github.com/AmitGupta700/Awesome_Python_Scripts/blob/main/AutomationScripts/Current%20Time%20Stamps/Images/Output.png)

## For any query please contact:
<a href="https://www.linkedin.com/in/amit-gupta-681206191/">LinkedIn</a>
41 changes: 41 additions & 0 deletions AutomationScripts/Current Time Stamps/current_time_stamps.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#Code for time in different timezones

#importing modules
import pendulum
import pyttsx3 #for speaking purpose

#function for speaking
def speak(text):
engine = pyttsx3.init()
engine.setProperty("rate", 170) #rate of speaking
voices = engine.getProperty("voices")
engine.setProperty("voice", voices[1].id) #for female voice
engine.say(text)
engine.runAndWait()

# Code

speak("Hello! I will convert time in desired timezones.")

#current details
d1 = pendulum.now()

#splitting for getting date and time only
dt1 = str(d1).split(".")

speak("Here's your current timezone with current date and time")
print(f"Current timezone : {d1.timezone_name}") #for displaying timezone
print(f"Current date and time: {dt1[0]}") #as we splited time and timezon

speak("Now enter the zone you wish to see the time!")
i = input("Enter here: ")

#details for inputed timezone
try:
d2 = pendulum.now(i)
dt2 = str(d2).split(".")
speak("Here's desired details")
print(f" Current date and time for {d2.timezone_name} : {dt2[0]}")
except Exception as e:
speak("Looks like you have entered incorrect timezone!")
speak("Please check it and try again!")
2 changes: 2 additions & 0 deletions AutomationScripts/Current Time Stamps/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import pendulum
import pyttsx3