test.py 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. # -*- coding:utf-8 -*-
  2. __author__ = 'weijie'
  3. from EmQuantAPI import *
  4. import datetime
  5. import time
  6. import traceback
  7. import json
  8. from StockRestPojo import StockRestPojo
  9. from dbOperation import dbOperation
  10. # print("开始了")
  11. # datTime = datetime.datetime.strptime("2020-1-23", "%Y-%m-%d")
  12. # print(datTime)
  13. # year = time.localtime(datTime1).tm_year # 获取年份
  14. # print(str(year) + "-01-01")
  15. # datTime = time.mktime(time.strptime(str(year) + "-01-01", "%Y-%m-%d"))
  16. # print(int(datTime))
  17. # month = time.localtime(datTime1).tm_mon # 获取月份
  18. # print(str(month))
  19. # year = time.localtime(datTime1).tm_year # 获取年份
  20. # if 10 > month:
  21. # print(str(year) + "-0" + str(month) + "-01")
  22. # datTime = time.mktime(time.strptime(str(year) + "-0" + str(month) + "-01", "%Y-%m-%d"))
  23. # print(int(datTime))
  24. # else:
  25. # print(str(year) + "-" + str(month) + "-01")
  26. # datTime = time.mktime(time.strptime(str(year) + "-" + str(month) + "-01", "%Y-%m-%d"))
  27. # print(int(datTime))
  28. in_date = '1994-04-12'
  29. # datTime1 = time.mktime(time.strptime(in_date, "%Y-%m-%d"))
  30. # wday = time.localtime(datTime1).tm_wday # 获取周
  31. dt = datetime.datetime.strptime(in_date, "%Y-%m-%d")
  32. out_date = (dt + datetime.timedelta(days=-wday)).strftime("%Y-%m-%d")
  33. datTime = time.mktime(time.strptime(out_date, "%Y-%m-%d"))
  34. # #获取日
  35. # datTime = time.mktime(time.strptime(in_date, "%Y-%m-%d"))
  36. # print(int(datTime))
  37. # print n_days.strftime('%Y-%m-%d')