times.py 360 B

1234567891011121314151617181920
  1. from time import localtime
  2. from datetime import date, datetime, time, timedelta
  3. Date = date
  4. Time = time
  5. TimeDelta = timedelta
  6. Timestamp = datetime
  7. def DateFromTicks(ticks):
  8. return date(*localtime(ticks)[:3])
  9. def TimeFromTicks(ticks):
  10. return time(*localtime(ticks)[3:6])
  11. def TimestampFromTicks(ticks):
  12. return datetime(*localtime(ticks)[:6])