What can it do?
Use pip to install :
pip install datedays
1. Get common date data
method |
describe |
Return results |
parameter |
getnow() |
Get today's date |
For example: 2022-08-16 17:56:17 |
|
gettomorrow() |
tomorrow |
2022-08-17 |
Optional number of days in the future (just pass in the number you want) |
getyesterday() |
yesterday |
2022-08-15 |
Optional number of days in the past (just pass in the number you want) |
getdays() |
Default date collection within three months |
...(recommend test printing) |
number=number of months desired |
getnowtimestamp() |
Get current timestamp |
1660644568238 |
Default milliseconds (optional seconds, milliseconds, microseconds) |
gettodaydays() |
By default, the collection of remaining days of this month is obtained |
...(recommend test printing) |
You can specify a certain day in a certain month to get the remaining days of the month. |
getnextdays() |
By default, the total number of days in the next month is obtained. |
...(recommend test printing) |
You can specify the month and the number of months |
getstr2timestamp() |
Convert date string to timestamp |
...(recommend test printing) |
Parameter 1: date, parameter 2: date format |
gettimestamp2str() |
Timestamp to date string |
...(recommend test printing) |
...(recommend test printing) |
getstarted() |
Calculate the number of days between dates |
...(recommend test printing) |
Parameter 1: start date, parameter 2: end date (default today) parameter 3: return date list |
2. Manipulate Excel reports
method |
describe |
Return results |
parameter |
excel_write_openpyxl() |
Write Excel report |
...(recommended testing) |
filename: file name, datas: data to be saved, format: [[First line], [Second line], [Third line]...] |
excel_read_openpyxl() |
Read Excel report |
...(recommended testing) |
filename: file name, sheet_index: subscript of sheet |
excel_read_xlrd() |
Read Excel reports (supports xls) |
...(recommended testing) |
filename: file name, sheet_index: subscript of sheet |
3. Perform common encryption signatures
method |
describe |
Return results |
parameter |
md2() |
MD2 encryption |
...(recommended testing) |
body: encrypted content, encode: encoding format |
md5() |
MD5 encryption |
...(default 32-bit result) |
body: encrypted content, encode: encoding format, length_: return length, optional 16 |
drink1() |
SHA1 encryption |
...(recommended testing) |
body: encrypted content, encode: encoding format |
sha2_224() |
SHA2_224 encryption |
...(recommended testing) |
body: encrypted content, encode: encoding format |
sha2_256() |
SHA2_256 encryption |
...(recommended testing) |
body: encrypted content, encode: encoding format |
sha2_384() |
SHA2_384 encryption |
...(recommended testing) |
body: encrypted content, encode: encoding format |
sha2_512() |
SHA2_512 encryption |
...(recommended testing) |
body: encrypted content, encode: encoding format |
sha3_224() |
SHA3_224 encryption |
...(recommended testing) |
body: encrypted content, encode: encoding format |
sha3_256() |
SHA3_256 encryption |
...(recommended testing) |
body: encrypted content, encode: encoding format |
sha3_384() |
SHA3_384 encryption |
...(recommended testing) |
body: encrypted content, encode: encoding format |
sha3_512() |
SHA3_512 encryption |
...(recommended testing) |
body: encrypted content, encode: encoding format |
4. Obtain the cryptographic signature of a file
method |
describe |
Return results |
parameter |
encrypt_smallfile() |
Encrypt small files |
...(recommended testing) |
filename: file name, mode: default md5 (optional encryption above) |
encrypt_bigfile() |
Encrypt large files |
...(recommended testing) |
filename: file name, mode: default md5 (optional encryption above) |
other...
Method |
description |
return result |
parameter |
getuuid() |
Get uuid (supports 1,3,4,5) |
... (recommended test) |
mode: default uuid4, merge: remove '-' |
getrandompassword() |
Randomly generate password string |
... (recommended test) |
k: return length (default 12), more_characters: splicing characters, recommended!@#$%.*&+- |
headers2dict() |
headers string to dict |
...(recommend test printing) |
Parameter 1: headers string |
example:
- Get a list of dates within 2 days to 10 days:
import datedays
if __name__ == '__main__':
print(datedays.getdays()[2:10]) # 2天之后,10天之内的日期列表
result:
['2022-08-11', '2022-08-12', '2022-08-13', '2022-08-14', '2022-08-15', '2022-08-16', '2022-08-17', '2022-08-18']
Click to jump to--》GitHub source code