Skip to content

Commit

Permalink
Merge branch 'main' of github.com:cloudmesh/cloudmesh-common
Browse files Browse the repository at this point in the history
  • Loading branch information
laszewsk committed Dec 15, 2023
2 parents f28087d + 21df35c commit bb404e3
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions cloudmesh/common/DateTime.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,15 @@ class DateTime(object):
"""

# timezone = time.tzname[0]
timezone = TIME.datetime.now().astimezone().tzinfo

@staticmethod
def now():
return TIME.datetime.utcnow()

@staticmethod
def local_now():
return TIME.datetime.now()

@staticmethod
def natural(time):
Expand Down Expand Up @@ -88,7 +92,7 @@ def utc_to_local(time):
timestamp = calendar.timegm(
(TIME.datetime.strptime(utc, TIME_FORMAT)).timetuple())
local = TIME.datetime.fromtimestamp(timestamp).strftime(TIME_FORMAT)
return local + " " + DateTime.timezone
return local + " " + str(DateTime.timezone)


if __name__ == "__main__":
Expand Down

0 comments on commit bb404e3

Please sign in to comment.