Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

get current week python

import datetime
my_date = datetime.date.today() # if date is 01/01/2018
year, week_num, day_of_week = my_date.isocalendar()
print("Week #" + str(week_num) + " of year " + str(year))
Comment

get weekday from date python

>>> import datetime
>>> datetime.datetime.today()
datetime.datetime(2012, 3, 23, 23, 24, 55, 173504)
>>> datetime.datetime.today().weekday()
4
Comment

python datetime weekday

from datetime import datetime
date_str='10-12-20'
datetime_object = datetime.strptime(date_str, '%m-%d-%y')
datetime_object.weekday()
Comment

how to get today weekday in python

today_day = date.today()
days = ["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","sunday"]
print("Today weekday is ",days[today_day.weekday()])
Comment

python datetime get weekday name

import datetime
now = datetime.datetime.now()
print(now.strftime("%A"))
Comment

get weekday from date python

# int value range: 0-6, monday-sunday
weekday = datetime.weekday()
Comment

How to get the date from week number in Python?

import datetime
from dateutil.relativedelta import relativedelta
 
week = 25
year = 2021
date = datetime.date(year, 1, 1) + relativedelta(weeks=+week)
print(date)
Comment

PREVIOUS NEXT
Code Example
Python :: random library python 
Python :: remove last element from list python 
Python :: python how to make notepad 
Python :: types of system 
Python :: clicking a button in selenium python 
Python :: change value in excel using python 
Python :: best python ide for ubuntu 
Python :: python set day of date to 1 
Python :: doc2vec similarity 
Python :: what does .shape do in python 
Python :: python socket recv set timeout 
Python :: program to print duplicates from a list of integers in python 
Python :: cut rows dataframe 
Python :: leap year python 
Python :: count characters in string python 
Python :: replace none with empty string python 
Python :: pandas crosstab 
Python :: pyspark rdd filter 
Python :: heatmap of pandas dataframe with seaborn 
Python :: difference between supervised and unsupervised learning 
Python :: datetime object to string 
Python :: python default dic 
Python :: number of column in dataset pandas 
Python :: convert rgb to a single value 
Python :: django timezone settings 
Python :: spam python 
Python :: python extract specific keys from dictionary 
Python :: zero crossing rate python 
Python :: sort an array python 
Python :: dummy variables pandas 
ADD CONTENT
Topic
Content
Source link
Name
7+7 =