utils.py 628 B

12345678910111213141516171819202122232425262728293031
  1. # This Python file uses the following encoding: utf-8
  2. # @author runhey
  3. # github https://github.com/runhey
  4. import re
  5. from pathlib import Path
  6. from datetime import datetime
  7. from PySide6.QtCore import QObject, Slot, Signal
  8. from module.logger import logger
  9. class Utils(QObject):
  10. def __init__(self) -> None:
  11. super(Utils, self).__init__()
  12. @Slot(result="QString")
  13. def current_datetime(self) -> str:
  14. """
  15. 获取当前的时间
  16. :return:
  17. """
  18. return datetime.now().strftime("%Y-%m-%d %H:%M:%S")
  19. if __name__ == "__main__":
  20. u = Utils()
  21. print(u.current_datetime())