def EpochTime(date):
 if isinstance(date, datetime.datetime):
  td = (date - BASE_DATE)
 else:
  td = (date - BASE_DATE.date())
 milliseconds_since_epoch = long(((td.microseconds + ((td.seconds + ((td.days * 24) * 3600)) * (10 ** 6))) / (10 ** 3)))
 return milliseconds_since_epoch

def EpochTime ( date ) : if isinstance ( date , datetime . datetime ) : td = ( date - BASE_DATE ) else : td = ( date - BASE_DATE . date ( ) ) milliseconds_since_epoch = long ( ( ( td . microseconds + ( ( td . seconds + ( ( td . days * 24 ) * 3600 ) ) * ( 10 ** 6 ) ) ) / ( 10 ** 3 ) ) ) return milliseconds_since_epoch
returns millisecond epoch time for a date or datetime .