added unixtolocal()

This commit is contained in:
iou1name 2019-11-02 17:40:25 -04:00
parent a7fb575a55
commit d46fe77dca

View File

@ -69,3 +69,11 @@ def idleTimeWulf(result, bot):
t = datetime.datetime.fromtimestamp(int(signon)) t = datetime.datetime.fromtimestamp(int(signon))
delta = datetime.datetime.now() - t delta = datetime.datetime.now() - t
bot.msg("Adalwulf" + "_"*delta.days) 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)