implement 'datetime_to_timestamp()'
and rename 'to_timestamp()' to the more descriptive 'datetime_to_timestamp_string()'
This commit is contained in:
@@ -173,8 +173,13 @@ def to_string(value):
|
||||
return str(value)
|
||||
|
||||
|
||||
def to_timestamp(dt):
|
||||
"""Convert naive datetime to UTC timestamp string"""
|
||||
def datetime_to_timestamp(dt):
|
||||
"""Convert naive UTC datetime to timestamp"""
|
||||
return (dt - EPOCH) / SECOND
|
||||
|
||||
|
||||
def datetime_to_timestamp_string(dt):
|
||||
"""Convert naive UTC datetime to timestamp string"""
|
||||
try:
|
||||
return str((dt - EPOCH) // SECOND)
|
||||
except Exception:
|
||||
|
||||
Reference in New Issue
Block a user