Skip to content
  • Tutorials
    • c programming
      • libraries
    • c++
    • Linux
    • Python
    • batch programming
    • Technology
  • IDE
  • Tools
datetime to int python 1

datetime to int python

April 27, 2022 by Anurag batra
from datetime import datetime

x = datetime.now()

x.toordinal()

Here is what the above code is Doing:
1. We created a datetime object, x, and assigned it to the current time.
2. We called the toordinal() method on x.
3. This returns the ordinal of the date, which is the number of days since January 1st, 1 AD.

Categories Python Examples
Post navigation
delete element from list value
input two numbers in python in a single line
© MyEduKit - 2022 . All Rights Reserved.