unixtolocal() converts to local timezone
This commit is contained in:
parent
d46fe77dca
commit
cc148145d3
|
@ -7,6 +7,7 @@ import datetime
|
||||||
from twisted.internet import defer
|
from twisted.internet import defer
|
||||||
|
|
||||||
from module import commands
|
from module import commands
|
||||||
|
import tools.time
|
||||||
|
|
||||||
|
|
||||||
def setup(bot):
|
def setup(bot):
|
||||||
|
@ -75,5 +76,6 @@ def idleTimeWulf(result, bot):
|
||||||
def unixtolocal(bot, trigger):
|
def unixtolocal(bot, trigger):
|
||||||
"""Converts the given timestamp from unix time to local time."""
|
"""Converts the given timestamp from unix time to local time."""
|
||||||
unix = int(trigger.group(2))
|
unix = int(trigger.group(2))
|
||||||
dt = datetime.datetime.utcfromtimestamp(unix).strftime('%Y-%m-%d %H:%M:%S')
|
dt = datetime.datetime.utcfromtimestamp(unix)
|
||||||
bot.msg(dt)
|
dt = dt.replace(tzinfo=datetime.timezone.utc)
|
||||||
|
bot.msg(dt.astimezone(tz=None).strftime('%Y-%m-%d %H:%M:%S'))
|
||||||
|
|
Loading…
Reference in New Issue
Block a user