Time class
  A time object can hold the local time of a day. The time zone information
    can adjusted by implementing the abstract class tzinfo. Various methods are
    available with this abstract class which can be implemented  desired by
    the user.
Constructor
  datetime. time (h=0, min=0, sec=0, ms=0, tzinfo=None)
  The parameters required to call the constructor of the time class are
  hours, minutes, seconds, micro-seconds and tzinfo. If the tzinfo is none, then there will be no information on time zone. Look
  at the example below:
Attributes of the class
  The attributes of the time class are listed below.
- time.min - (h=0, min=0, sec=0, ms=0) The earliest possible time.
- time.max - (h=23, min=59, sec=59, ms=999999) The latest time possible.
- time.resolution - the minimum possible difference between two time objects which are not equal.
    Other instance attributes are
    hour, minute, second, microsecond and tzinfo. Using these attributes each component can be accessed individually. For
    example:
  
Methods in time class
1. time.replace() : To change any of the component like hour/min/sec/microsec.
2. time.isoformat() : To represent the time in ISO format HH:MM:SS. mmmmmm. If microsecond is zero or none, then the format is HH:MM:SS.
3. time.__str__() : To get the string format of the time object.
4. time.strftime( 'formatting string' ) : To setup the formatting characters for displaying time. For fomatting directives visit this link.
5. time.utcoffset() : If tzinfo is not none, then for the given time zone, the difference between the standard UTC time and current time zone's time is returned.
6. time.tzname() : If tzinfo is not none, returns the time zone name in string format.
Some examples :
      Next Page👉	
    
Comments
Post a Comment