Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Date Attributes | Working with Dates
Dealing with Dates and Times in Python
course content

Зміст курсу

Dealing with Dates and Times in Python

Dealing with Dates and Times in Python

1. Working with Dates
2. Working with Times
3. Timezones and Daylight Savings Time (DST)
4. Working with Dates and Times in pandas

Date Attributes

Since date is an object, it should have some attributes. Let's consider them:

  • date.day - extracts day of the month (between 1 and number of days in the given month of the given year);
  • date.month - extracts month of the year;
  • date.year - extracts year of the given date;

For example, we can extract the day, month from the date object we created before.

123456789
# Load class from library from datetime import date # Create date object with positional arguments course_created = date(2021, 11, 1) # Extract the day and the month from date print("Month:", course_created.month) print("Day:", course_created.day)
copy

Завдання

Given the date 11th March 1998. You need to create a date object and then extract the day, month, and year from it.

Завдання

Given the date 11th March 1998. You need to create a date object and then extract the day, month, and year from it.

Перейдіть на комп'ютер для реальної практикиПродовжуйте з того місця, де ви зупинились, використовуючи один з наведених нижче варіантів

Все було зрозуміло?

Секція 1. Розділ 3
toggle bottom row

Date Attributes

Since date is an object, it should have some attributes. Let's consider them:

  • date.day - extracts day of the month (between 1 and number of days in the given month of the given year);
  • date.month - extracts month of the year;
  • date.year - extracts year of the given date;

For example, we can extract the day, month from the date object we created before.

123456789
# Load class from library from datetime import date # Create date object with positional arguments course_created = date(2021, 11, 1) # Extract the day and the month from date print("Month:", course_created.month) print("Day:", course_created.day)
copy

Завдання

Given the date 11th March 1998. You need to create a date object and then extract the day, month, and year from it.

Завдання

Given the date 11th March 1998. You need to create a date object and then extract the day, month, and year from it.

Перейдіть на комп'ютер для реальної практикиПродовжуйте з того місця, де ви зупинились, використовуючи один з наведених нижче варіантів

Все було зрозуміло?

Секція 1. Розділ 3
toggle bottom row

Date Attributes

Since date is an object, it should have some attributes. Let's consider them:

  • date.day - extracts day of the month (between 1 and number of days in the given month of the given year);
  • date.month - extracts month of the year;
  • date.year - extracts year of the given date;

For example, we can extract the day, month from the date object we created before.

123456789
# Load class from library from datetime import date # Create date object with positional arguments course_created = date(2021, 11, 1) # Extract the day and the month from date print("Month:", course_created.month) print("Day:", course_created.day)
copy

Завдання

Given the date 11th March 1998. You need to create a date object and then extract the day, month, and year from it.

Завдання

Given the date 11th March 1998. You need to create a date object and then extract the day, month, and year from it.

Перейдіть на комп'ютер для реальної практикиПродовжуйте з того місця, де ви зупинились, використовуючи один з наведених нижче варіантів

Все було зрозуміло?

Since date is an object, it should have some attributes. Let's consider them:

  • date.day - extracts day of the month (between 1 and number of days in the given month of the given year);
  • date.month - extracts month of the year;
  • date.year - extracts year of the given date;

For example, we can extract the day, month from the date object we created before.

123456789
# Load class from library from datetime import date # Create date object with positional arguments course_created = date(2021, 11, 1) # Extract the day and the month from date print("Month:", course_created.month) print("Day:", course_created.day)
copy

Завдання

Given the date 11th March 1998. You need to create a date object and then extract the day, month, and year from it.

Перейдіть на комп'ютер для реальної практикиПродовжуйте з того місця, де ви зупинились, використовуючи один з наведених нижче варіантів
Секція 1. Розділ 3
Перейдіть на комп'ютер для реальної практикиПродовжуйте з того місця, де ви зупинились, використовуючи один з наведених нижче варіантів
We're sorry to hear that something went wrong. What happened?
some-alt