|
Examples
import parsedatetime.parsedatetime as pdt import parsedatetime.parsedatetime_consts as pdc # create an instance of Constants class so we can override some of the defaults c = pdc.Constants() # create an instance of the Calendar class and pass in our Constants # object instead of letting it create a default p = pdt.Calendar(c) # parse "tomorrow" and return the result result = p.parse("tomorrow") # parseDate() is a helper function that bypasses all of the # natural language stuff and just tries to parse basic dates # but using the locale information result = p.parseDate("4/4/80") # parseDateText() is a helper function that tries to parse # long-form dates using the locale information result = p.parseDateText("March 5th, 1980") |
► Sign in to add a comment
It looks like some lines are being merged where they shouldn't, for example there are two import statements in the first line.
The two import lines missing:
@maciej.blizinski: You are right, just copy and paste without thinking about someone who has to read this.
if you didnt know:
you produce a readable text here.
It is easy.
When you are using times, do not use a period to separate hours and minutes, you must use a colon.
e.g. "today at 1:50PM"