| 88 | |
| 89 | @staticmethod |
| 90 | def GetUpdateStr(createdTime): |
| 91 | timeArray = time.strptime(createdTime, "%Y-%m-%dT%H:%M:%S.%f%z") |
| 92 | now = int(time.time()) |
| 93 | tick = int(time.mktime(timeArray) - time.timezone) |
| 94 | day = (now - tick) // (24 * 3600) |
| 95 | hour = (now - tick) // 3600 |
| 96 | minute = (now - tick) // 60 |
| 97 | second = (now - tick) |
| 98 | from tools.str import Str |
| 99 | if day > 0: |
| 100 | return "{}".format(day) + Str.GetStr(Str.DayAgo) |
| 101 | elif hour > 0: |
| 102 | return "{}".format(hour) + Str.GetStr(Str.HourAgo) |
| 103 | elif minute > 0: |
| 104 | return "{}".format(minute) + Str.GetStr(Str.MinuteAgo) |
| 105 | else: |
| 106 | return "{}".format(second) + Str.GetStr(Str.SecondAgo) |
| 107 | |
| 108 | @staticmethod |
| 109 | def GetUpdateStrByTick(tick): |