Python Datetime objects and Timedelta | Python30 | Day 2

Python Datetime objects and Timedelta | Python30 | Day 2

PyLenin

5 лет назад

10,207 Просмотров

Ссылки и html тэги не поддерживаются


Комментарии:

@shaarg
@shaarg - 09.06.2019 07:24

Interesting. Thanks a lot 😊 question 🙋
1. How do I convert this easily to Long number format?
2. Any updates on the large csv reading video?

Ответить
@vickysharma_
@vickysharma_ - 09.06.2019 10:54

Hi Lenin, thanks for the effort put in to take time out for us and making videos. For ascertaining a time in the past, instead of giving negative value to Days,Hours and Minutes, I would just minus the time_diff from the date_time like past_date_time = date_time - time_diff. This would give the same result I guess. Thanks again..

Ответить
@vickysharma_
@vickysharma_ - 09.06.2019 11:03

My solution to Problem 1:


from datetime import date, timedelta

christmas = date(year=2019,month=12,day=25)

time_diff = timedelta(days = 7)

one_week_before_christmas = christmas - time_diff

one_week_before_christmas

Ответить
@vickysharma_
@vickysharma_ - 09.06.2019 11:13

My solution to Problem 2:


from datetime import datetime, timedelta
day_in_future = datetime(year = 2020, month = 5, day = 20, hour = 22, minute = 30)
day_in_past = datetime(year = 2019, month=1, day=1, hour=11)
time_diff = day_in_future - day_in_past
time_diff

Ответить
@drummerb0y4tune
@drummerb0y4tune - 09.06.2019 19:39

So whats the difference between Datetime Module and Time Module ?

Ответить
@sunilghimire6990
@sunilghimire6990 - 10.07.2019 10:46

Req_date = curr_date - time_diff

Ответить
@Michael-sc7yt
@Michael-sc7yt - 05.11.2019 15:43

Hi, your explanation is easy to understand. My timedelta is in pandas.......pd.timedelta Is it the same as datetime.timedelta?

Ответить
@gunpoopoom2072
@gunpoopoom2072 - 25.06.2020 11:47

thank you

Ответить
@mageshwarans5367
@mageshwarans5367 - 22.06.2021 20:41

very helpful

Ответить
@nagarjunatutika2002
@nagarjunatutika2002 - 03.07.2021 09:45

Thank for the effort. But please make a video difference of two dates and difference results is only in days

Ответить
@zma314125
@zma314125 - 18.08.2021 23:02

Thank you!

Ответить
@MilindBabar
@MilindBabar - 21.05.2022 12:18

Thank you so much for this video

Ответить
@jongcheulkim7284
@jongcheulkim7284 - 23.05.2022 15:18

Thank you^^

Ответить
@wartem
@wartem - 20.07.2022 13:31

Someone likes Suits 🙂

Ответить