Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Lucksi
GitHub Repository: Lucksi/Mr.Holmes
Path: blob/master/Core/Support/DateFormat.py
1071 views
1
# ORIGINAL CREATOR: Luca Garofalo (Lucksi)
2
# AUTHOR: Luca Garofalo (Lucksi)
3
# Copyright (C) 2023 Lucksi <[email protected]>
4
# License: GNU General Public License v3.0
5
6
from configparser import ConfigParser
7
from Core.Support import Font
8
from Core.Support import Language
9
10
filename = Language.Translation.Get_Language()
11
filename
12
13
class Get:
14
15
@staticmethod
16
def Format():
17
Config_file = "Configuration/Configuration.ini"
18
Parser = ConfigParser()
19
Parser.read(Config_file)
20
dataformat = Parser["Settings"]["date_format"]
21
if dataformat == "eu":
22
dateregex = "%d/%m/%Y %H:%M:%S"
23
localformat = "DD/MM/YYYY"
24
elif dataformat == "us":
25
dateregex = "%m/%d/%Y %H:%M:%S"
26
localformat = "MM/DD/YYYY"
27
elif dataformat == "as":
28
dateregex = "%Y/%m/%d %H:%M:%S"
29
localformat = "YYYY/MM/DD"
30
else:
31
dateregex = "%d/%m/%Y %H:%M:%S"
32
Zone = dataformat.upper() + ":"+ localformat
33
print(Font.Color.BLUE + "\n[I]" + Font.Color.WHITE + Language.Translation.Translate_Language(filename, "Default", "DateFormat", "None").format("[" + Font.Color.GREEN + Zone + Font.Color.WHITE + "]"))
34
return dateregex
35
36
@staticmethod
37
def Format2():
38
Config_file = "Configuration/Configuration.ini"
39
Parser = ConfigParser()
40
Parser.read(Config_file)
41
dataformat = Parser["Settings"]["date_format"]
42
if dataformat == "eu":
43
dateregex = "%d/%m/%Y"
44
elif dataformat == "us":
45
dateregex = "%m/%d/%Y"
46
elif dataformat == "as":
47
dateregex = "%Y/%m/%d"
48
else:
49
dateregex = "%d/%m/%Y"
50
return dateregex
51
52
@staticmethod
53
def Continent():
54
Config_file = "Configuration/Configuration.ini"
55
Parser = ConfigParser()
56
Parser.read(Config_file)
57
dataformat = Parser["Settings"]["date_format"]
58
if dataformat == "eu":
59
continent = "EUROPE |"
60
elif dataformat == "us":
61
continent = "AMERICA |"
62
elif dataformat == "as":
63
continent = "ASIA |"
64
else:
65
continent = "EUROPE |"
66
return continent
67