locky 1 жил өмнө
parent
commit
1a57ca18cd
1 өөрчлөгдсөн 11 нэмэгдсэн , 0 устгасан
  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