xxxxxxxxxx
from datetime import datetime
import pytz
# Set timezone to Asia/Kolkata
timezone = pytz.timezone('Asia/Kolkata')
# Get current time in India
current_time = datetime.now(timezone)
# Format the time string
time_string = current_time.strftime('%Y-%m-%d %H:%M:%S')
print('Current time in India:', time_string)
xxxxxxxxxx
import datetime
from pytz import timezone
# Set the timezone for India
india_timezone = timezone('Asia/Kolkata')
# Get the current time in India
current_time = datetime.datetime.now(india_timezone)
formatted_time = current_time.strftime("%Y-%m-%d %H:%M:%S")
print("Current time in India:", formatted_time)
xxxxxxxxxx
import datetime
import pytz
# Get the current time in India
india_timezone = pytz.timezone('Asia/Kolkata')
current_time = datetime.datetime.now(india_timezone)
# Format the time
formatted_time = current_time.strftime('%Y-%m-%d %H:%M:%S %Z%z')
print("Current time in India:", formatted_time)
xxxxxxxxxx
import datetime
import pytz
# Set the timezone to 'Asia/Kolkata' for India
timezone = pytz.timezone('Asia/Kolkata')
# Get the current time in India
current_time = datetime.datetime.now(timezone)
# Format the current time
formatted_time = current_time.strftime('%Y-%m-%d %H:%M:%S %Z%z')
print("Current time in India:", formatted_time)