Python Date and Time

Python is exceptionally valuable if there should be an occurrence of Date and Time. We can without much of a stretch recover current date and time utilizing Pythn.

Recover Time

To recover current time a predefined capacity localtime() is utilized. localtime() gets a parameter time. time() Here, time is a module, time() is a capacity that profits the present framework time in number of ticks subsequent to 11:00 pm , March 5, 2014. It is known as year. Tick is basically a skimming point number in seconds since year.


The time returned is a period structure which incorporates 9 characteristics. These are summoned in the table given beneath.

Attribute Description
tm_year Returns the current year
tm_mon Returns the current month
tm_mday Returns the current month day
tm_hour Returns the current hour.
tm_min Returns the current minute
tm_sec Returns current seconds
tm_wday Returns the week day
tm_yday Returns the year day.
tm_isdst It returns -1,0 or 1.

Designed Time

Python likewise bolster arranged time. Continue as takes after:

  • Hang loose structure in a predefined capacity asctime(). It is a capacity characterized in time module.
  • It gives back an organized time which incorporates Day , month, date, time and year.
  • Print the organized time.