ニジカ AI 共通サービス
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

37 lines
767 B

  1. from __future__ import annotations
  2. import asyncio
  3. from datetime import date, datetime, time
  4. async def main (
  5. ) -> None:
  6. ...
  7. def dt_to_tuple (
  8. dt: datetime | date | time,
  9. ) -> tuple[int | None, int | None, int | None, int | None, int | None, int | None]:
  10. year: int | None = None
  11. month: int | None = None
  12. day: int | None = None
  13. hour: int | None = None
  14. minute: int | None = None
  15. second: int | None = None
  16. if not isinstance (dt, time):
  17. year = dt.year
  18. month = dt.month
  19. day = dt.day
  20. if not isinstance (dt, date):
  21. hour = dt.hour
  22. minute = dt.minute
  23. second = dt.second
  24. return (year, month, day, hour, minute, second)
  25. if __name__ == '__main__':
  26. asyncio.run (main ())