ATM作业讲解:

 

数据访问层

业务逻辑层

 

 1 import time
 2 
 3 
 4 # print(time.clock()) #返回处理器时间,3.3开始已废弃 , 改成了time.process_time()测量处理器运算时间,不包括sleep时间,不稳定,mac上测不出来
 5 # print(time.altzone)  #返回与utc时间的时间差,以秒计算\
 6 # print(time.asctime()) #返回时间格式"Fri Aug 19 11:14:16 2016",
 7 # print(time.localtime()) #返回本地时间 的struct time对象格式
 8 # print(time.gmtime(time.time()-800000)) #返回utc时间的struc时间对象格式
 9 
10 # print(time.asctime(time.localtime())) #返回时间格式"Fri Aug 19 11:14:16 2016",
11 #print(time.ctime()) #返回Fri Aug 19 12:38:29 2016 格式, 同上
12 
13 
14 
15 # 日期字符串 转成  时间戳
16 # string_2_struct = time.strptime("2016/05/22","%Y/%m/%d") #将 日期字符串 转成 struct时间对象格式
17 # print(string_2_struct)
18 # #
19 # struct_2_stamp = time.mktime(string_2_struct) #将struct时间对象转成时间戳
20 # print(struct_2_stamp)
21 
22 
23 
24 #将时间戳转为字符串格式
25 # print(time.gmtime(time.time()-86640)) #将utc时间戳转换成struct_time格式
26 # print(time.strftime("%Y-%m-%d %H:%M:%S",time.gmtime()) ) #将utc struct_time格式转成指定的字符串格式
27 
28 
29 
30 
31 
32 #时间加减
33 import datetime
34 
35 # print(datetime.datetime.now()) #返回 2016-08-19 12:47:03.941925
36 #print(datetime.date.fromtimestamp(time.time()) )  # 时间戳直接转成日期格式 2016-08-19
37 # print(datetime.datetime.now() )
38 # print(datetime.datetime.now() + datetime.timedelta(3)) #当前时间+3天
39 # print(datetime.datetime.now() + datetime.timedelta(-3)) #当前时间-3天
40 # print(datetime.datetime.now() + datetime.timedelta(hours=3)) #当前时间+3小时
41 # print(datetime.datetime.now() + datetime.timedelta(minutes=30)) #当前时间+30分
42 
43 
44 #
45 # c_time  = datetime.datetime.now()
46 # print(c_time.replace(minute=3,hour=2)) #时间替换
View Code

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-02-07
  • 2022-02-01
  • 2021-11-26
  • 2022-02-06
  • 2021-05-31
  • 2021-06-10
猜你喜欢
  • 2021-06-07
  • 2021-08-07
  • 2022-12-23
  • 2021-09-14
  • 2022-01-21
  • 2021-07-05
  • 2021-05-19
相关资源
相似解决方案