-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTools-0005.py
More file actions
34 lines (23 loc) · 775 Bytes
/
Tools-0005.py
File metadata and controls
34 lines (23 loc) · 775 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import time
import datetime
fileName = "test"
t = time.time()
#this the format for showing
format = "type is: %-30s , value is: %s "
#show the time
print(format %(str(type(t)),str(t)))
dateWithTime = datetime.datetime.now()
# check the type of dateWithTime
print(format %(str(type(dateWithTime)),str(dateWithTime)))
#get the date only
# date = datetime.datetime.date(dateWithTime)
# print(format %(str(type(date)),str(date)))
#another way of getting date
date = datetime.date.today()
print(format %(str(type(date)),str(date)))
#change the type of date
strDate = str(date)
print(format %(str(type(strDate)),str(strDate)))
#add the date and time in file name
fileName = fileName+'-'+strDate+'-'+str(round(t)%10000)
print(format %(str(type(fileName)),str(fileName)))