Compare dates

0 votes
How to compare two dates in python?
Jun 14, 2018 in Python by nightshade
• 870 points
17 views

1 answer to this question.

0 votes
>>> from datetime import datetime
>>> past = datetime.now()
>>> present = datetime.now()
>>> past < present
True
answered Jun 14, 2018 by Hamartia's Mask
• 1,580 points

Related Questions In Python

0 votes
1 answer

How can I compare the content of two files in Python?

Assuming that your file unique.txt just contains ...READ MORE

answered Apr 16, 2018 in Python by charlie_brown
• 7,710 points
56 views
0 votes
1 answer

Write dates as datetime objects

from datetime import datetime datetime_object = datetime.strptime('Aug 23 ...READ MORE

answered Apr 18, 2018 in Python by Nietzsche's daemon
• 4,260 points
13 views
0 votes
1 answer

Number of days between dates in Python

You can use the date module to ...READ MORE

answered May 30, 2018 in Python by Nietzsche's daemon
• 4,260 points
26 views
0 votes
1 answer

Which is better if we compare C vs Python?

It depends on what do you expect ...READ MORE

answered Mar 6 in Python by SDeb
• 12,360 points
11 views
0 votes
1 answer

how to compare two strings in python?

compare two string in python >>> s1="abc ...READ MORE

answered Mar 25 in Python by rajesh
• 1,210 points
34 views
0 votes
1 answer
+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 129 views
+4 votes
6 answers