avoid error when timestamp is already a date
This commit is contained in:
parent
1629defe3d
commit
674cd62ae6
1 changed files with 2 additions and 0 deletions
|
@ -38,6 +38,8 @@ def date2TimeStamp(d):
|
||||||
def timeStamp2Date(ts, useGM=False):
|
def timeStamp2Date(ts, useGM=False):
|
||||||
if ts is None:
|
if ts is None:
|
||||||
ts = getTimeStamp()
|
ts = getTimeStamp()
|
||||||
|
if not isinstance(ts, (int, float)): # seems to be a date already
|
||||||
|
return ts
|
||||||
return datetime.fromtimestamp(ts)
|
return datetime.fromtimestamp(ts)
|
||||||
|
|
||||||
def timeStamp2ISO(ts, useGM=False, format='%Y-%m-%d %H:%M'):
|
def timeStamp2ISO(ts, useGM=False, format='%Y-%m-%d %H:%M'):
|
||||||
|
|
Loading…
Add table
Reference in a new issue