Did I find the right examples for you? yes no Crawl my project Python Jobs
All Samples(44) | Call(40) | Derive(0) | Import(4)
Parse a date from a string. This function uses the date format for the locale as a hint to determine the order in which the date fields appear in the string. >>> parse_date('4/1/04', locale='en_US') datetime.date(2004, 4, 1) >>> parse_date('01.04.2004', locale='de_DE') datetime.date(2004, 4, 1) (more...)
def parse_date(string, locale=LC_TIME): """Parse a date from a string. This function uses the date format for the locale as a hint to determine the order in which the date fields appear in the string. >>> parse_date('4/1/04', locale='en_US') datetime.date(2004, 4, 1) >>> parse_date('01.04.2004', locale='de_DE') datetime.date(2004, 4, 1) :param string: the string containing the date :param locale: a `Locale` object or a locale identifier """ # TODO: try ISO format first? format = get_date_format(locale=locale).pattern.lower() year_idx = format.index('y') month_idx = format.index('m') if month_idx < 0: month_idx = format.index('l') day_idx = format.index('d') indexes = [(year_idx, 'Y'), (month_idx, 'M'), (day_idx, 'D')] indexes.sort() indexes = dict([(item[1], idx) for idx, item in enumerate(indexes)]) # FIXME: this currently only supports numbers, but should also support month # names, both in the requested locale, and english numbers = re.findall('(\d+)', string) year = numbers[indexes['Y']] if len(year) == 2: year = 2000 + int(year) else: year = int(year) month = int(numbers[indexes['M']]) day = int(numbers[indexes['D']]) if month > 12: month, day = day, month return date(year, month, day)
The parsed date object. """ return dates.parse_date(string, locale=self.locale) def parse_datetime(self, string):
src/a/p/appscale-HEAD/AppServer/lib/webapp2-2.5.2/webapp2_extras/i18n.py appscale(Download)
The parsed date object. """ return dates.parse_date(string, locale=self.locale) def parse_datetime(self, string):
src/a/p/appscale-HEAD/AppServer/lib/webapp2-2.5.1/webapp2_extras/i18n.py appscale(Download)
The parsed date object. """ return dates.parse_date(string, locale=self.locale) def parse_datetime(self, string):
src/a/p/appscale-HEAD/AppServer/lib/webapp2-2.3/webapp2_extras/i18n.py appscale(Download)
The parsed date object. """ return dates.parse_date(string, locale=self.locale) def parse_datetime(self, string):
src/k/a/KalaPy-0.4.2/kalapy/i18n/format.py KalaPy(Download)
def parse_date(string): """Parse a date from a string. """ return dates.parse_date(string, locale=get_locale())
src/k/a/kalapy-HEAD/kalapy/i18n/format.py kalapy(Download)
def parse_date(string): """Parse a date from a string. """ return dates.parse_date(string, locale=get_locale())
src/g/o/google-app-engine-HEAD/lib/webapp2-2.5.2/webapp2_extras/i18n.py google-app-engine(Download)
The parsed date object. """ return dates.parse_date(string, locale=self.locale) def parse_datetime(self, string):
src/g/o/google-app-engine-HEAD/lib/webapp2-2.5.1/webapp2_extras/i18n.py google-app-engine(Download)
The parsed date object. """ return dates.parse_date(string, locale=self.locale) def parse_datetime(self, string):
src/g/o/google-app-engine-HEAD/lib/webapp2-2.3/webapp2_extras/i18n.py google-app-engine(Download)
The parsed date object. """ return dates.parse_date(string, locale=self.locale) def parse_datetime(self, string):
src/g/o/googleappengine-python-HEAD/lib/webapp2-2.5.2/webapp2_extras/i18n.py googleappengine-python(Download)
The parsed date object. """ return dates.parse_date(string, locale=self.locale) def parse_datetime(self, string):
1 | 2 | 3 | 4 Next