code: def jstimestamp_slow(dte):
      '''Convert a date or datetime object into a javsacript timestamp'''
      year, month, day, hour, minute, second = dte.timetuple()[:6]
      days = date(year, month, 1).toordinal() - _EPOCH_ORD + day - 1
      hours = days*24 + hour
      minutes = hours*60 + minute
      seconds = minutes*60 + second
      if isinstance(dte,datetime):
          return 1000*seconds + 0.001*dte.microsecond
      else:
          return 1000*secondf jstimestamp_slow(dte):
      '''Convert a date or datetime object into a javsacript timestamp'''
      year, month, day, hour, minute, second = dte.timetuple()[:6]
      days = date(year, month, 1).toordinal() - _EPOCH_ORD + day - 1
      hours = days*24 + hour
      minutes = hours*60 + minute
      seconds = minutes*60 + second
      if isinstance(dte,datetime):
          return 1000*seconds + 0.001*dte.microsecond
      else:
          return 1000*seconds
docs: Convert a date or datetime object into a javsacript timestamp