-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTime.py
58 lines (40 loc) · 1.26 KB
/
Time.py
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
import json
import datetime
from operator import __mod__
from typing import Any
DataFileJson = open("data.json", 'r', encoding="utf8")
DataJson = json.load(DataFileJson)
DataFileJson.close()
Time = DataJson['Time']
def Est_Bissextile(year):
""" Return Calendar Bissextile or not """
if (year % 4 == 0 and year % 100 != 0) or year % 400 == 0:
return Time['BMonthDay']
else:
return Time['MonthDay']
def Get_NowDate():
""" Return Date Today / Now """
return datetime.date.today()
def Get_OpenHour():
""" Return Open Hour """
return Time['Hour']
def Get_Hour(hour):
""" Return Reel Hour With index (0, 12) """
return Time['Hour'][hour]
def Get_ReelClientHour(hour, day, month):
""" Return Reel Client with Indic and Type """
return int(round(Time['HourType'][hour] * Time['IndicDays'][day] * Time['IndicMonth'][month]))
def Get_Month(month: int):
""" Return Name Month with index """
return Time['Mois'][month]
def JourSemaine(d: int, m: int, y: int):
""" Return Name Day and Day """
if m >= 3:
y1 = y
dec = -2
else:
y1 = y - 1
dec = 0
day = (23 * m // 9 + d + 4 + y + y1 // 4 - y1 // 100 + y1 // 400 + dec) % 7
dayF = Time['dayT'][day]
return [dayF, day]