Example #1
0
def parse_date(s):
    s = s.replace(u'Fév', 'Feb') \
         .replace(u'Avr', 'Apr') \
         .replace(u'Mai', 'May') \
         .replace(u'Juin', 'Jun') \
         .replace(u'Juil', 'Jul') \
         .replace(u'Aoû', 'Aug') \
         .replace(u'Ao\xfbt', 'Aug') \
         .replace(u'Déc', 'Dec')
    return local2utc(_parse_dt(s))
Example #2
0
def parse_date(s):
    s = s.replace(u'Fév', 'Feb') \
         .replace(u'Avr', 'Apr') \
         .replace(u'Mai', 'May') \
         .replace(u'Juin', 'Jun') \
         .replace(u'Juil', 'Jul') \
         .replace(u'Aoû', 'Aug') \
         .replace(u'Ao\xfbt', 'Aug') \
         .replace(u'Déc', 'Dec')
    return local2utc(_parse_dt(s))
Example #3
0
def parse_dt(s):
    now = datetime.datetime.now()
    if s is None:
        return local2utc(now)
    if 'minutes ago' in s:
        m = int(s.split()[0])
        d = now - datetime.timedelta(minutes=m)
    elif u'–' in s:
        # Date in form : "Yesterday – 20:45"
        day, hour = s.split(u'–')
        day = day.strip()
        hour = hour.strip()
        if day == 'Yesterday':
            d = now - datetime.timedelta(days=1)
        elif day == 'Today':
            d = now
        hour = _parse_dt(hour)
        d = datetime.datetime(d.year, d.month, d.day, hour.hour, hour.minute)
    else:
        #if ',' in s:
        # Date in form : "Dec 28, 2011")
        d = _parse_dt(s)
    return local2utc(d)
Example #4
0
def parse_dt(s):
    now = datetime.datetime.now()
    if s is None:
        return local2utc(now)
    if "minutes ago" in s:
        m = int(s.split()[0])
        d = now - datetime.timedelta(minutes=m)
    elif u"–" in s:
        # Date in form : "Yesterday – 20:45"
        day, hour = s.split(u"–")
        day = day.strip()
        hour = hour.strip()
        if day == "Yesterday":
            d = now - datetime.timedelta(days=1)
        elif day == "Today":
            d = now
        hour = _parse_dt(hour)
        d = datetime.datetime(d.year, d.month, d.day, hour.hour, hour.minute)
    else:
        # if ',' in s:
        # Date in form : "Dec 28, 2011")
        d = _parse_dt(s)
    return local2utc(d)
Example #5
0
def parse_dt(s):
    d = _parse_dt(s)
    return local2utc(d)
Example #6
0
def parse_dt(s):
    d = _parse_dt(s)
    return local2utc(d)