add timestamp to short time
This commit is contained in:
1 parent
eae52a8faf
commit
ba8d429a9f
1 file changed
+8
@@ -108,6 +108,14 @@ def str_to_datetime(dt_str):
|
||||
except ValueError: # If dt_str did not match our format
|
||||
return None
|
||||
|
||||
def timestamp_to_short_time_str(timestamp):
|
||||
""" Converts a UNIX timestamp to a short time string format.
|
||||
|
||||
@rtype: str
|
||||
"""
|
||||
return dt.datetime.fromtimestamp(
|
||||
int(timestamp)).strftime(TIME_SHORT_STR_FORMAT)
|
||||
|
||||
|
||||
def strip_microseconds(dattim):
|
||||
""" Returns a copy of dattime object but with microsecond set to 0. """
|
||||
|
||||
Reference in new issue
Block a user