Sql Uts
Installation
pip install dateUts
GitHub
https://github.com/ZdekPyPi/SqlUts
Usage
sqlToDate
from dateUts import sqlToDate
result = sqlToDate('1991-12-23')
print(result)
datetime.datetime(1991, 12, 23, 0, 0)
dateToSql
from dateUts import dateToSql
from datetime import datetime
today = datetime.now()
result = dateToSql(today)
print(result)
'2022-05-25'
now
from dateUts import now
now1 = now()
now2 = now(fmt='%Y-%d-%m')
now3 = now(fmt='sql')
print(now1)
print(now2)
print(now3)
datetime.datetime(2022, 5, 25, 18, 57, 5, 710329)
'2022-05-25'
'2022-25-05'
today
from dateUts import today
today1 = today()
today2 = today(fmt='%Y-%d-%m')
today3 = today(fmt='sql')
today4 = today(fmt='sql',addDays=1)
today5 = today(fmt='sql',addDays=-1)
print(today1)
print(today2)
print(today3)
print(today4)
print(today5)
datetime.datetime(2022, 5, 25, 18, 57, 5, 710329)
'2022-05-25'
'2022-25-05'
'2022-25-06'
'2022-25-04'
yesterday
from dateUts import yesterday
ystd1 = yesterday()
ystd2 = yesterday(fmt='%Y-%d-%m')
ystd3 = yesterday(fmt='sql')
print(ystd1)
print(ystd2)
print(ystd3)
datetime.datetime(2022, 5, 24, 18, 57, 5, 710329)
'2022-24-05'
'2022-05-24'
dateRange
from dateUts import sqlToDate,dateRange
start = sqlToDate('2022-05-01')
end = sqlToDate('2022-05-03')
range1 = dateRange(start,end)
range2 = dateRange(start,end,fmt='sql')
print(range1)
print(range2)
[datetime.datetime(2022, 5, 1, 0, 0), datetime.datetime(2022, 5, 2, 0, 0), datetime.datetime(2022, 5, 3, 0, 0)]
['2022-05-01', '2022-05-02', '2022-05-03']
dateAdd
from dateUts import sqlToDate,dateToSql,dateAdd
mydate = sqlToDate('2022-05-02')
mydate_plus1_day = dateAdd(mydate,1,'day')
mydate_less1_day = dateAdd(mydate,-1,'day')
mydate_plus1_yer = dateAdd(mydate,1,'year')
print(dateToSql(mydate))
print(dateToSql(mydate_plus1_day))
print(dateToSql(mydate_less1_day))
print(dateToSql(mydate_plus1_yer))
'2022-05-02'
'2022-05-03'
'2022-05-01'
'2023-05-02'
lastWorkingDate
from dateUts import lastWorkingDate
#Assuming today as '2022-05-25'
dt = lastWorkingDate(fmt='sql')
print(dt)
#Assuming today as '2022-05-23'
dt = lastWorkingDate(fmt='sql')
print(dt)
'2022-05-24'
'2022-05-20'
DateMatch
from dateUts import dateMatch
dt = dateMatch('2022-01-01','sql')
print(dt)
dt = dateMatch('2022-01-01','%Y-%m-%d')
print(dt)
True
True
Change Log
0.0.1 (2022-06-10)
- First Release
0.0.2 (2022-06-10)
- Required libs
0.0.3 (2022-06-11)
- TblUts
0.0.4 (2022-07-20)
- Adjustment at sqlToDate function
0.0.5 (2022-05-25)
- Readme details
0.0.9 (2022-08-18)
- DateMatch
Metadata
Release files for sqlUts 1.0.8
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| sqluts-1.0.8.tar.gz | 4.1 kB | Without provenance | Details for sqluts-1.0.8.tar.gz |
Release files / sqluts-1.0.8.tar.gz
| Download URL | sqluts-1.0.8.tar.gz |
|---|---|
| Size | 4.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2e3b0b9fd48e698eeda02f1b70d63ffc8ec4b3e0ebf9ca0579296de3dd8376f0
|
|
BLAKE2b-256 checksum How to use checksums |
26fa8593179f7cadebedc79397fc10276f541ee99ca80ec884df58f0d68774e4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.10.11
|
Security for sqlUts 1.0.8
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.