Browse Source

更新 'dgp/tests/util/date_util.py'

cary 4 years ago
parent
commit
e3098abf64
1 changed files with 12 additions and 0 deletions
  1. 12 0
      dgp/tests/util/date_util.py

+ 12 - 0
dgp/tests/util/date_util.py

@@ -284,6 +284,18 @@ def checkInterval(start_time, end_time, need_compare_time):
     return need_compare_time >= start_time and need_compare_time < end_time
 
 
+def getSelfDateStr(times=time.time(),date_format='%Y%m%d'):
+    """
+    ## 20201028添加,阳光接口,日期参数请求格式20201028,一日一拉api数据
+    description:  获取指定时间戳
+    time:         秒 默认当前时间
+    return:       返回指定时间戳的前一日日期 。 比如 :接收20190512号的时间戳,返回 20190513 -> str
+    tips:         一天86400
+    """
+    timestamps = str(time.strftime(date_format,time.localtime(times)))
+    return timestamps
+  
+  
 def test():
     print(getCurrentMilliSecondTime())
     print(getCurrentSecondTime())