# -*- coding:utf-8 -*- __author__ = 'weijie' from EmQuantAPI import * import datetime import time import traceback import json from StockRestPojo import StockRestPojo from dbOperation import dbOperation # print("开始了") # datTime = datetime.datetime.strptime("2020-1-23", "%Y-%m-%d") # print(datTime) # year = time.localtime(datTime1).tm_year # 获取年份 # print(str(year) + "-01-01") # datTime = time.mktime(time.strptime(str(year) + "-01-01", "%Y-%m-%d")) # print(int(datTime)) # month = time.localtime(datTime1).tm_mon # 获取月份 # print(str(month)) # year = time.localtime(datTime1).tm_year # 获取年份 # if 10 > month: # print(str(year) + "-0" + str(month) + "-01") # datTime = time.mktime(time.strptime(str(year) + "-0" + str(month) + "-01", "%Y-%m-%d")) # print(int(datTime)) # else: # print(str(year) + "-" + str(month) + "-01") # datTime = time.mktime(time.strptime(str(year) + "-" + str(month) + "-01", "%Y-%m-%d")) # print(int(datTime)) in_date = '1994-04-12' # datTime1 = time.mktime(time.strptime(in_date, "%Y-%m-%d")) # wday = time.localtime(datTime1).tm_wday # 获取周 dt = datetime.datetime.strptime(in_date, "%Y-%m-%d") out_date = (dt + datetime.timedelta(days=-wday)).strftime("%Y-%m-%d") datTime = time.mktime(time.strptime(out_date, "%Y-%m-%d")) # #获取日 # datTime = time.mktime(time.strptime(in_date, "%Y-%m-%d")) # print(int(datTime)) # print n_days.strftime('%Y-%m-%d')