locky 1 anno fa
parent
commit
1a57ca18cd
1 ha cambiato i file con 11 aggiunte e 0 eliminazioni
  1. 11 0
      Service/CommonService.py

+ 11 - 0
Service/CommonService.py

@@ -317,3 +317,14 @@ class CommonService:
             content = content.decode('utf-8')
             content = content[i:-i]
         return content
+
+    @staticmethod
+    def timestamp_to_str(timestamp):
+        """
+        时间戳转时间字符串
+        @param timestamp: 时间戳
+        @return time_str: 时间字符串
+        """
+        struct_time = time.localtime(timestamp)
+        time_str = time.strftime("%Y-%m-%d %H:%M:%S", struct_time)
+        return time_str