What is timedelta in python?

0 votes
can you give an example?
May 27 in Python by Waseem
• 4,480 points
26 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 by Wajiha
• 1,920 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,420 points
1,323 views
+4 votes
7 answers
+1 vote
3 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
90 views
+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 6 in Python by Neha
• 330 points

edited Jul 8 by Kalgi 222 views
+4 votes
6 answers
0 votes
1 answer

What is the use of join()?

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

answered Jun 20 in Python by Wajiha
• 1,920 points
15 views
0 votes
1 answer

Slicing a list using a variable, in Python

Yes its possible. Use the following piece ...READ MORE

answered Jul 2 in Python by Wajiha
• 1,920 points
22 views