Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

get local timezone python

import datetime

now = datetime.datetime.now()
local_now = now.astimezone()
local_tz = local_now.tzinfo
local_tzname = local_tz.tzname(local_now)
print(local_tzname)
Comment

localize timezone python

import pytz
from datetime import datetime

tz = pytz.timezone('Asia/Kathmandu')
datetime = datetime.now()
new_date = tz.localize(datetime)
Comment

PREVIOUS NEXT
Code Example
Python :: finding the index of an item in a pandas df 
Python :: ip regex python 
Python :: django change user password 
Python :: show multiple matplotlib images 
Python :: pandas group by multiple columns and count 
Python :: ascii to decimal python 
Python :: pytorch freeze layers 
Python :: find record where dataframe column value contains 
Python :: python permutation 
Python :: python print utf-8 
Python :: distinct rows in this DataFrame 
Python :: how to delete a csv file in python 
Python :: small factorial codechef solution 
Python :: numpy drop duplicates 
Python :: python select columns with no na 
Python :: save and load model pytorch 
Python :: how to draw a rectangle in pygame 
Python :: python program to count even and odd numbers in a list 
Python :: python ascii code to string 
Python :: how to create empty series in pandas 
Python :: pre commit python 
Python :: Ask a user for input python 
Python :: how to say something python 
Python :: multiple arguments in python 
Python :: python check if string is in input 
Python :: python continue 
Python :: django permission required 
Python :: list comprehenstsion using lambda funcion 
Python :: how to check if an input is a string in python 
Python :: matplotlib logarithmic scale 
ADD CONTENT
Topic
Content
Source link
Name
4+7 =