What is timedelta in python

0 votes
can you give an example?
May 27, 2019 in Python by Waseem
• 4,540 points
776 views

1 answer to this question.

0 votes

It represents a duration which is basically difference between dates. It can also be used for datetime manipulations.

EXAMPLE:

i = datetime.datetime(2000, 3,  11,  7, 45,  23)
j = datetime.datetime( 2019,  6, 8, 2, 45, 13)
k = j - i
print(type(k))
print("k =", k)

OUTPUT:

<class 'datetime.timedelta'>
k = 7027 days, 18:59:50
answered Aug 7, 2019 by Wajiha
• 1,960 points

Related Questions In Python

+2 votes
3 answers

what is the practical use of polymorphism in Python?

Polymorphism is the ability to present the ...READ MORE

answered Mar 31, 2018 in Python by anto.trigg4
• 3,440 points
4,942 views
+4 votes
7 answers
+1 vote
7 answers
0 votes
1 answer

What is the use of raw_input function in Python?

raw_input fuction is no longer available in ...READ MORE

answered May 2, 2018 in Python by aayushi
• 750 points
1,298 views
0 votes
2 answers
+1 vote
2 answers

how can i count the items in a list?

Syntax :            list. count(value) Code: colors = ['red', 'green', ...READ MORE

answered Jul 7, 2019 in Python by Neha
• 330 points

edited Jul 8, 2019 by Kalgi 4,468 views
0 votes
1 answer
+5 votes
6 answers

Lowercase in Python

You can simply the built-in function in ...READ MORE

answered Apr 11, 2018 in Python by hemant
• 5,790 points
4,128 views
0 votes
1 answer

Performing divison on timedelta object in python?

Refer the following piece of code: e1=datetime.timedelta(days=32, seconds=0, ...READ MORE

answered Aug 13, 2019 in Python by Wajiha
• 1,960 points
2,728 views
0 votes
1 answer

What is the use of join()?

Join()  function is used in threading to ...READ MORE

answered Jun 20, 2019 in Python by Wajiha
• 1,960 points
678 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP