def parsetime(t):
    
    timeformats = [
        '%Y.%m.%d-%H:%M:%S.%f',
        '%Y.%m.%d-%H:%M:%S',
        '%Y.%m.%d-%H:%M',
        '%Y.%m.%d',
        '%Y%m%d%H%M%S%f',
        '%Y%m%d%H%M%S',
        '%Y%m%d%H%M',
        '%Y%m%d',
        '%Y.%m',
        '%Y',
        '%Y.%m.%d-%H:%M:%S.%f',
        '%Y/%m/%d-%H:%M:%S',
        '%Y/%m/%d-%H:%M',
        '%Y/%m/%d',
        '%Y/%m',
        '%Y'
    ]
    alt_formats = {
       'now' : datetime.datetime.utcnow(),
       'today' : datetime.date.today(),
    }
    high_level = [
        (re.compile('today(\+|-)([0-9]+)'), _from_today),
        (re.compile('now(\+|-)([0-9]+w)?([0-9]+d)?([0-9]+h)?([0-9]+m)?([0-9]+s)?([0-9]+ms)?'), _from_now)
    ]

    if not t:
        return None

    ret = None
    for tf in timeformats:
        try:
            ret = datetime.datetime.strptime(t, tf)
        except:
            pass

    if not ret and t in alt_formats:
        return alt_formats[t]
    elif not ret:
        for tf, l in high_level:
            k = tf.match(t)
            if k:
                ret = l(k)
    if ret:
        return ret
    else:
        raise ValueError('time data does not match any valid format: ' + t)
Parses a time string into a datetime object.  This is the function used by parse the dates in an OWS request, so
dataset/ETHPy150Open hydroshare/hydroshare2/ga_resources/utils.py/parsetime