Created
March 15, 2024 05:56
-
-
Save avalanchy/805d8dafb53facbb80f87acef7960a24 to your computer and use it in GitHub Desktop.
python date datetime isinstance
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ ipython | |
Python 3.12.2 (main, Mar 5 2024, 10:30:14) [GCC 13.2.0] | |
Type 'copyright', 'credits' or 'license' for more information | |
IPython 8.20.0 -- An enhanced Interactive Python. Type '?' for help. | |
In [1]: from datetime import datetime, date | |
In [2]: dt = datetime.now() | |
In [3]: d = dt.date() | |
In [4]: isinstance(dt, datetime) | |
Out[4]: True | |
In [5]: isinstance(dt, date) | |
Out[5]: True | |
In [6]: isinstance(d, datetime) | |
Out[6]: False | |
In [7]: isinstance(d, date) | |
Out[7]: True |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment