From the previous blogs we talked about the data types in Python. From this blog I’m going to write about another important module in python, Date and Time. When we are working with the date and time we have to use Python’s inbuilt time, calendar modules. For that first of all we have to import them.
Now let’s see how we can use some of the basic commands with date and time.
- ‘time()‘ gives the ticks since 12:00am, January 1, 1970.
- ‘localtime()‘ is used to get the localtime in parameters.
- ‘asctime()‘ make it more readable.
- ‘month()‘ shows a calendar in detail.
- ‘timezone()‘ gives your time zone.
- Another useful method in use is the ‘tzname()‘.
- ‘isleap()‘ will find out whether a given year is a leap year or not.
These are some basic methods used in time and calendar modules. Though this is a very short post it’s much worth to talk about. Hope to see you soon with another interesting topic. Thank You!