Alarm Time is a python module in python which is used to play with the date and time, using default datetime module of python. A date in Python is not a data type of its own, but we can import a module named datetime to work with dates as date objects. It has functions for finding difference between the dates in days or hours or seconds. This module is able to find the dates from the string text, like mentioning date for next 10 days in string format.
Installation:
pip install AlarmTime
Methods (Major Functions):
DateTimeDetect : It detects the date from the string
hour_diff_from_now : It gives difference between dates in hours
millisecond_diff_from_now: It gives difference between dates in milliseconds
minute_diff_from_now : It gives difference between dates in minutes
second_diff_from_now : It gives difference between dates in seconds
Example 1:
In this example, we will create a detectdate object to print the dates
Python3
from AlarmTime.AlarmTime import DetectDate
current = DetectDate( 0 )
print (current.now)
another = DetectDate( 1 )
print (another.now)
another2 = DetectDate( 1570010023345 )
print (another2.now)
|
Output :

Example 2:
Here we will use various major functions with the DetectDate object.
Python3
from AlarmTime.AlarmTime import DetectDate
first_date = DetectDate( 1570010023345 )
current = DetectDate( 0 )
seconds = current.second_diff_from_now( "after 10 days" )
print ( "Seconds Difference : " + str (seconds))
target_time = current.DateTimeDetect(
'detect the time and date on October 10 10 p.m' )
print ( "Detected date : " + str (target_time))
target_time2 = current.DateTimeDetect(
'after 6 month 500 days 10 hours 15 minutes' )
print ( "Detected date after some time : " + str (target_time2))
|
Output :
