Example #1
0
def timeval_to_epoch(val, fmt):
    """Converts any string, number, datetime or Qdate or QDatetime to epoch"""
    if is_archaelogical():
        return bcdate_util.timeval_to_epoch(val)
    try:
        return int(val)
    except:
        try:
            return float(val)
        except:
            if type(val) in [QtCore.QDate, QtCore.QDateTime]:
                val = QDateTime_to_datetime(val)
            if type(val) in [str, basestring, unicode]:
                val = str_to_datetime(val, fmt)
            return datetime_to_epoch(val)
Example #2
0
def timeval_to_epoch(val, fmt):
    """Converts any string, number, datetime or Qdate or QDatetime to epoch"""
    if is_archaelogical():
        return bcdate_util.timeval_to_epoch(val)
    try:
        return int(val)
    except:
        try:
            return float(val)
        except:
            if type(val) in [QtCore.QDate, QtCore.QDateTime]:
                val = QDateTime_to_datetime(val)
            if type(val) in [str, basestring, unicode]:
                val = str_to_datetime(val, fmt)
            return datetime_to_epoch(val)