Python Date and Time Mastery: Managing Temporal Data
Now that you have created your
dt object, you may have noticed that this is a proprietary
Datetime object and, therefore, some methods may fail when applied to it. For that reason,
datetime provides some functions to transform the
datetime object into a string. This is particularly useful when you are in need of changing the formatting.
- Create a
Datetimeobject with the current date and time;
- Use the
strftime()module to change the formatting in
- Print the type of the
Everything was clear?