Practice #25: Count the number of Friday 13th in the given year _ Python Coding for Beginners

Опубликовано: 23 Октябрь 2024
на канале: Make Everyday EZ Day
1,149
like

#Python #Programming #for #Beginners

Check out my video for the guide to format and convert date/time object to string object:
   • Tutorial #25: How to Format Date and ...  

Below are the character codes to format the date and time:
%d: Returns the day of the month, from 1 to 31.
%m: Returns the month of the year, from 1 to 12.
%Y: Returns the year in four-digit format (Year with century). like, 2021.
%y: Returns year in two-digit format (year without century). like, 19, 20, 21
%A: Returns the full name of the weekday. Like, Monday, Tuesday
%a: Returns the short name of the weekday (First three character.). Like, Mon, Tue
%B: Returns the full name of the month. Like, June, March
%b: Returns the short name of the month (First three character.). Like, Mar, Jun
%H: Returns the hour. from 01 to 23.
%I: Returns the hour in 12-hours format. from 01 to 12.
%M: Returns the minute, from 00 to 59.
%S: Returns the second, from 00 to 59.
%f: Return the microseconds from 000000 to 999999
%p: Return time in AM/PM format
%c: Returns a locale’s appropriate date and time representation
%x: Returns a locale’s appropriate date representation
%X: Returns a locale’s appropriate time representation
%z: Return the UTC offset in the form ±HHMM[SS[.ffffff]] (empty string if the object is naive).
%Z: Return the Time zone name (empty string if the object is naive).
%j: Returns the day of the year from 01 to 366
%w: Returns weekday as a decimal number, where 0 is Sunday and 6 is Saturday.
%U: Returns the week number of the year (Sunday as the first day of the week) from 00 to 53
%W: Returns the week number of the year (Monday as the first day of the week) from 00 to

some useful date attributes/methods you might need to work with datetime objects:
date.day
date.month
date.year
date.today()
date.weekday()

-------------------------
Python Tutorial for Beginners,
Python Coding for Beginners,
Python Programming for Beginners,
Learn Python by Building Projects,
Python Exercises and Practical Examples with solutions,
Practice Python Online with solution,
How to write a Python program,
Python Programming Data Structure and Algorithm,
Python Problem Solving,
Python Game Tutorial,
Python Game Programming,
Python Game Development,
Python Tips and Tricks,

tags:
How do I display weekday in Python?
How do I get the current week Monday date in Python?
How do you get weekend and weekday in Python?
How do you print days in Python?
how to get weekday from a given date in python?
How to get day name from datetime - python
Python Get date from weekday of current week
python - How to get which day of week is a specific date
How do you use the date method in Python?
What are date formats in Python?
How do you represent a date in Python?
Is there a date data type in Python?
How to Format date using strftime() in Python
Using Python datetime to Work With Dates and Times
get date from datetime python