<jupyter_start><jupyter_text>All Time related commands<jupyter_code>import datetime
print(dir(datetime))<jupyter_output>['MAXYEAR', 'MINYEAR', '__builtins__', '__cached__', '__doc__', '__file__', '__loader__', '__name__', '__package__', '__spec__', 'date', 'datetime', 'datetime_CAPI', 'sys', 'time', 'timedelta', 'timezone', 'tzinfo']<jupyter_text>datetime.date<jupyter_code>datetime.date(2021,3,27)        # Input is necessary to work
datetime.date(2021,3,27).ctime()         # Style string datetime.date.ctime()
datetime.date(2021,3,27).weekday()       # type:  method_descriptor Saturday = 5, Sunday = 6, Monday =0
datetime.date(2021,3,27).day         # type : getset descriptor   String : <attribute 'day' of 'datetime.date' objects>
datetime.date(2021,3,27).month      # type : getset descriptor    String : <attribute 'day' of 'datetime.date' objects> 
datetime.date(2021,3,27).year       # type : getset descriptor    String : <attribute 'day' of 'datetime.date' objects> 
datetime.date.fromtimestamp(time.time())
MAXYEAR = datetime.MAXYEAR
datetime.date(2021,3,27).max                            # type : date # gives the same output even without date
datetime.date(2021,3,27).min                            # type : date # gives the same output even without date
datetime.date(2021,3,27).replace(year=1988)    # type : method_descriptor      Docstring: Return date with new specified fields
datetime.date(2021,3,27).resolution         # The smallest possible difference between non equal date objects.  Usedon'tknow
                                            # Of the given year, month and day the smallest possible time is day.
                                            # type : timedelta
datetime.date(2021,3,27).strftime("%Y")                       # type : method_descriptor         # Style string
#datetime.date(2021,3,27).strftime("%m")                      # In the same way
#datetime.date(2021,3,27).strftime("%d")                       # In the same way
datetime.date(2021,3,27).timetuple()  # type : method_descriptor #Docstring: Return time tuple, compatible with time.localtime()
datetime.date.today()                        # Type:  builtin_function_or_method
str(datetime.timedelta(seconds=86399))   #$ Takes seconds and gives it in hours hours minutes and seconds
str(datetime.timedelta(seconds=86401))    #$ Takes seconds and gives it in days hours minutes and seconds
str(datetime.timedelta(seconds=start))    #$ Takes seconds and gives it in days hours minutes and seconds<jupyter_output><empty_output><jupyter_text>datetime.datetime<jupyter_code>datetime.datetime(2021,3,27,15,53,24).astimezone()               # type : method_descriptor
from datetime import date, time
d = date(2004, 7, 14)
t = time(12, 30)
datetime.datetime.combine(d, t)  # builtin_function_or_method
datetime.datetime(2004, 7, 14, 12, 30).ctime()      # type : method_descriptor    # Style string datetime.date.ctime()
datetime.datetime(2004, 7, 14, 12, 30).date()       # type : method_descriptor
datetime.datetime(2004, 7, 14, 12, 30).day  #type:getset descriptor #String form:<attribute 'day' of 'datetime.date' objects>
datetime.datetime(2004, 7, 14, 12, 30).fold  # Something related to daylight saving
datetime.datetime(2004, 7, 14, 12, 30).hour #type:getset descriptor #String form:<attribute 'hour' of 'datetime.datetime' objects>
datetime.datetime.max
datetime.datetime.min
datetime.datetime(2004, 7, 14, 12, 30, 24, 72).microsecond #type:getset descriptor #<attribute 'microsecond' of 'datetime.datetime' objects>
datetime.datetime(2004, 7, 14, 12, 30, 24, 72).minute #type:getset descriptor #<attribute 'minute' of 'datetime.datetime' objects>
datetime.datetime(2004, 7, 14, 12, 30, 24, 72).second #type:getset descriptor #<attribute 'second' of 'datetime.datetime' objects>
datetime.datetime(2004, 7, 14, 12, 30, 24, 72).month #type:getset descriptor #<attribute 'month' of 'datetime.date' objects>
datetime.datetime(2004, 7, 14, 12, 30, 24, 72).year #type:getset descriptor #<attribute 'month' of 'datetime.date' objects>
datetime.datetime.now() # Signature: datetime.datetime.now(tz=None) # Docstring: Returns new datetime object representing current time local to tz.
datetime.datetime(2004, 7, 14, 12, 30, 24, 72).replace(hour=16,minute=19,second=14) # type : method descriptor
datetime.datetime(2004, 7, 14, 12, 30, 24, 72).resolution # type : timedelta
datetime.datetime(2004, 7, 14, 12, 30, 24, 72).strftime("%Y")      # type : method_descriptor         # Style string
                                            #datetime.date(2021,3,27).strftime("%m")                      # In the same way
                                            #datetime.date(2021,3,27).strftime("%d")                       # In the same way
datetime.datetime(2004, 7, 14, 12, 30, 24, 72).strftime("%A %B")   # type : method_descriptor
datetime.datetime(2004, 7, 14, 12, 30, 24, 72).strftime("%I:%M%p") # type : method_descriptor
dt = datetime.datetime.strptime("21/11/06 16:30", "%d/%m/%y %H:%M")   # Type:      builtin_function_or_method
dt
datetime.datetime(2021, 3, 27, 16, 19, 14, 73470).time()
datetime.datetime(2021, 3, 27, 16, 19, 14, 73470).time().isoformat() #.isoformat is good for time but not date and time combined
datetime.datetime(2021, 3, 27, 16, 19, 14, 73470).timestamp()   # giving seconds from 51.26... years to now
                                                                # type : method_descriptor
                                                                # Docstring: Return POSIX timestamp as float.
str(datetime.timedelta(seconds=1616842154.07347)) 
18713/365
datetime.datetime(2021, 3, 27, 16, 19, 14, 73470).timetuple() # Type:method_descriptor
                                                    # Docstring: Return time tuple, compatible with time.localtime().
datetime.datetime.today()                       #  Type :  builtin_function_or_method
datetime.datetime(2021, 3, 27, 16, 50, 33, 860575).tzinfo # Type : getset_descriptor No tz info is provided in input
datetime.datetime(2021, 3, 27, 16, 50, 33, 860575).tzname() # Type : method descriptor No tz info is provided in input
datetime.datetime.utcfromtimestamp(1616842154.07347) # Type: builtin_function_or_method
                                                     # Docstring: Construct a naive UTC datetime from a POSIX timestamp
datetime.datetime.utcfromtimestamp(1616842154.07347).strftime('%Y-%m-%d %H:%M:%S')
datetime.datetime.utcfromtimestamp(1616842154.07347).isoformat()   # Don't know what is that T after date
print(datetime.datetime.utcnow().strftime("%Y-%m-%d %H:%M:%S"))  # Type:builtin_function_or_method
print(datetime.datetime.utcnow().isoformat())<jupyter_output>2021-03-27 11:33:24
2021-03-27T11:33:24.133724<jupyter_text>datetime.datetime.utcoffset()                 Needs tzinfo<jupyter_code>datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")
datetime.datetime(2021, 3, 27, 10, 49, 14, 73470).utctimetuple()    # mind it is utc timetuple, there is other timetuple also
datetime.datetime(2021, 3, 27, 10, 49, 14, 73470).weekday()  # Type: method_descriptor # this exists for datetime.date too.<jupyter_output><empty_output><jupyter_text>datetime.time()  =  same as datetime.datetime.time()   with tzinfo<jupyter_code>datetime.timedelta(2021, 3, 27, 10, 49, 14, 73470).days          
datetime.timedelta(seconds=44609323743.010025).days  # 44609323743.010025 seconds make 516311 days
datetime.timedelta(2021, 3, 27, 10, 49, 14, 73470).total_seconds()       # type : method_descriptor
datetime.timedelta(2021, 3, 27, 10, 49, 14, 73470).seconds # Docstring: Number of seconds (>= 0 and less than 1 day).
datetime.timedelta(2021, 3, 27, 10, 53, 14, 73470).microseconds # Docstring:Number of microseconds (>= 0 and less than 1 second)
datetime.timedelta(2021, 3, 27, 10, 49, 14, 73470).resolution() # The smallest ......    # type : timedelta
datetime.timedelta(2021, 3, 27, 10, 49, 14, 73470).max                # type : timedelta
datetime.timedelta(2021, 3, 27, 10, 49, 14, 73470).min()              # type : timedelta<jupyter_output><empty_output><jupyter_text>datetime.timezone   and    datetime.tzinfo   and    datetime.sys din't provide information. May be they are not that useful.<jupyter_code>import time
print(dir(time))
time.altzone()
time.asctime()           #$ Don't know the correct usage but without any arguments gives weekday month date time and year.
time.ctime()            #$ Don't know the correct usage but without any arguments gives weekday month date time and year.
time.ctime(1)         # This particular libraries first second happened at January 1st Early morning 5:30 AM  on year 1970.
time.gmtime()        # Green Meridian Time (GMT) or Coordination of Universal Time (UTC)
time.localtime()
datetime.timedelta(days = 25).total_seconds()
time.localtime(2160000)   # 25 days have completed from 1970 1st Jan 5:30.<jupyter_output><empty_output><jupyter_text>timple tuple means this (tm_year=1970, tm_mon=1, tm_mday=26, tm_hour=5, tm_min=30, tm_sec=0, tm_wday=0, tm_yday=26, tm_isdst=0)<jupyter_code>time.mktime((1970,1, 26, 5, 30, 0, 0, 26, 0))        # time tuple supplied, got no.of seconds from Epoch to time tuple supplied.
time.monotonic()              # Seconds   # Don't know its use though it shows some values
datetime.timedelta(seconds=311454.5)                 # This clock is working since 3 days
time.monotonic_ns()           # Nano seconds
datetime.timedelta(seconds=(311494000000000)*(10)**-9)            # This clock is working since 3 days.
time.perf_counter()
str(datetime.timedelta(seconds=31617.4078301))
time.perf_counter_ns()                  # Return the value (in fractional seconds) of a performance counter, i.e. a clock 
                                        # with the highest available resolution to measure a short duration. It does include 
                                        # time elapsed during sleep and is system-wide. The reference point of the returned 
                                        # value is undefined, so that only the difference between the results of two calls is 
                                        # valid.
datetime.timedelta(seconds=(31881595510200)*(10)**-9)  
time.process_time()      # sum of the kernel and user-space CPU time.
str(datetime.timedelta(seconds=time.process_time()))
time.process_time_ns()   # sum of the kernel and user-space CPU time.
str(datetime.timedelta(seconds=(time.process_time_ns()*(10)**-9)))<jupyter_output><empty_output><jupyter_text>time.sleep()    Usage not known<jupyter_code>time.strftime('%Y-%m-%d %H:%M:%S')
time.strftime((1970,1, 26, 5, 30, 0, 0, 26, 0))
time.strptime('2021-03-27 20:24:20','%Y-%m-%d %H:%M:%S')<jupyter_output><empty_output><jupyter_text>As per the python documentation time.strftime and time.struct_time need to take 9 argument format, but are not taking.<jupyter_code>time.thread_time()          # some kind of system+cpu times as discussed above. Need to revisit. But maynotbe significant now.
time.thread_time_ns()       # ns means nanoseconds. without ns is seconds.
time.time()          # No.of seconds since the Epoch
str(datetime.timedelta(seconds=1616857784.8116784)) #18713 days, 15:09:44 since Epoch
time.time_ns()       # ns means nanoseconds<jupyter_output><empty_output><jupyter_text>time.timezone()    No. info  time.tzname()       Don't know how to use<jupyter_code>time.time()                                                                            # seconds
years*365*24*60*60
24*60*60<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.12126216968011126, 'fraction_numerical': 0.08570931849791377, 'mean_word_length': 3.3579545454545454, 'pattern_counts': {'":': 0, '<': 49, '<?xml version=': 0, '>': 51, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 1, 'word_list_counts': {'cursed_substrings.json': 52, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '10', 'dir': 'jupyter-structured-clean-dedup', 'id': '270127', 'license': 'Apache-2.0', 'n_tokens_mistral': 4237, 'n_tokens_neox': 3476, 'n_words': 983, 'path': 'Time.ipynb', 'repo_name': 'sudheer1710/Case-studies-repractice', 'size': '11504'}