text2datetime (version 1.0.0)
index

text2datetime - Convert a text string to a datetime object. Supports relative-to-now modifiers, various timestamps, and words.

 
Package Contents
       

 
Functions
       
applyFixedTimeComponent(datetimeObj, fixedTimeStr)
applyFixedTimeComponent - Update a datetime object, replacing the time portion with the given time string.
 
PUBLIC FUNCTION
 
Time string is at minimum hours and minutes, with optional seconds and optional AM/PM.
 
@param datetimeObj <datetime.datetime> - Datetime
@param fixedTimeStr <str> - Time String as hours:minutes or hours:minutes:seconds, with optional AM/PM suffix.
 
@return <datetime.datetime> - datetimeObj with time replaced.
text2datetime(timeStr, now=None, monthBeforeDay=True)
text2datetime - Convert a time string to a datetime.datetime object. This method supports all the types of time strings described in text2datetime.FORMAT_HELP_MSG
 
PUBLIC FUNCTION
 
@param timeStr <str> - String of time.
@param now <None/datetime.datetime> - Default None will use current time. Otherwise, calculate time relative to given datetime.
@param monthBeforeDay <bool> - If True, American time format will be used when applicable (month/day/year). If False, European time (day/month/year) will be used when applicable.
 
print ( text2datetime.FORMAT_HELP_MSG ) for information on the format of timeStr.
 
@return <datetime.datetime> - Datetime object representing parsed time.

 
Data
        FORMAT_HELP_MSG = 'Date should be in one of the following forms:\n\n ...ck format, starting with 00=midnight, 23 = 11PM\n\n'
__all__ = ('FORMAT_HELP_MSG', 'text2datetime', 'applyFixedTimeComponent')
__version_tuple__ = (1, 0, 0)