parsedatetime
ΒΆParse human-readable date/time strings.
An example of how to use parsedatetime:
import parsedatetime
cal = parsedatetime.Calendar()
cal.parse("tomorrow")
To get it to a Python datetime
object:
from datetime import datetime
time_struct, parse_status = cal.parse("tomorrow")
datetime(*time_struct[:6])
Parse datetime with timezone support (using pytz
package):
import parsedatetime
import pytz
from pytz import timezone
cal = parsedatetime.Calendar()
datetime_obj, _ = cal.parseDT(datetimeString="tomorrow", tzinfo=timezone("US/Pacific"))
More Info: https://github.com/bear/parsedatetime