From d46fe77dcac941dbe0e9187ee239e25a8bc95cbf Mon Sep 17 00:00:00 2001 From: iou1name Date: Sat, 2 Nov 2019 17:40:25 -0400 Subject: [PATCH] added unixtolocal() --- modules/uptime.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/modules/uptime.py b/modules/uptime.py index 62070cf..e1ab8b8 100755 --- a/modules/uptime.py +++ b/modules/uptime.py @@ -69,3 +69,11 @@ def idleTimeWulf(result, bot): t = datetime.datetime.fromtimestamp(int(signon)) delta = datetime.datetime.now() - t bot.msg("Adalwulf" + "_"*delta.days) + + +@commands('unix') +def unixtolocal(bot, trigger): + """Converts the given timestamp from unix time to local time.""" + unix = int(trigger.group(2)) + dt = datetime.datetime.utcfromtimestamp(unix).strftime('%Y-%m-%d %H:%M:%S') + bot.msg(dt)