Date package
Project description
Sql Uts
Installation
pip install dateUts
GitHub
https://github.com/ZdekPyPi/DateUts
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'
nextWorkingDate
from dateUts import nextWorkingDate
#Assuming today as '2023-01-20'
dt = nextWorkingDate(fmt='sql')
print(dt)
#Assuming today as '2023-01-19'
dt = nextWorkingDate(fmt='sql')
print(dt)
'2023-01-23'
'2023-01-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
IsWeekend
#Preteend today is sunday
from dateUts import today,tomorrow
dt = today()
print(dt.is_weekend())
dt = tomorrow()
print(dt.is_weekend())
True
False
Interval
#Preteend today is sunday
from dateUts import today,tomorrow
print(interval(today(),tomorrow().date,in_days=True))
print(interval(today(),tomorrow().date,in_minutes=True))
print(interval(today(),tomorrow().date,in_seconds=True))
1.0
1440.0
86400.0
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
0.1.0 (2022-10-03)
- Add Hours,Minutes and Seconds
0.1.1 (2023-01-18)
- Next Working Day
0.1.2 (2023-04-20)
- is_weeekend
0.1.6 (2023-04-26)
- fmt bug date adjust
0.2.3 (2023-07-11)
- interval
0.2.4 (2023-09-25)
- different formats outputs
0.2.5 (2023-09-25)
- fix getFormat
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file dateuts-0.3.3.tar.gz.
File metadata
- Download URL: dateuts-0.3.3.tar.gz
- Upload date:
- Size: 5.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0ad0f6c9c4f40d835bd5fd0f24919a756cb982f1cebd57fb91d5626bff6d53fb
|
|
| MD5 |
0ced2b7a50f2a7e8c4634e33caaa3aa9
|
|
| BLAKE2b-256 |
64aee08f9a7e4cf46c7c98a92538bf248ea76b19a963afda28c1a57b5134862c
|
Provenance
The following attestation bundles were made for dateuts-0.3.3.tar.gz:
Publisher:
deploy.yml on ZdekPyPi/DateUts
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
dateuts-0.3.3.tar.gz -
Subject digest:
0ad0f6c9c4f40d835bd5fd0f24919a756cb982f1cebd57fb91d5626bff6d53fb - Sigstore transparency entry: 1317375743
- Sigstore integration time:
-
Permalink:
ZdekPyPi/DateUts@1fb3bb19a8ea6713b9d928d989a090d2e3bb9d41 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/ZdekPyPi
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
deploy.yml@1fb3bb19a8ea6713b9d928d989a090d2e3bb9d41 -
Trigger Event:
push
-
Statement type:
File details
Details for the file dateuts-0.3.3-py3-none-any.whl.
File metadata
- Download URL: dateuts-0.3.3-py3-none-any.whl
- Upload date:
- Size: 5.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
94d8bcc527e363315be098f602219901007abfa0937412b5ca46d8680266e945
|
|
| MD5 |
a2754291ed3d08d7f89b0a2d579347a4
|
|
| BLAKE2b-256 |
c76099a724df1aebf3545970bccc06cf1463a837d52c4a07fb99bcf9e0e00ad6
|
Provenance
The following attestation bundles were made for dateuts-0.3.3-py3-none-any.whl:
Publisher:
deploy.yml on ZdekPyPi/DateUts
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
dateuts-0.3.3-py3-none-any.whl -
Subject digest:
94d8bcc527e363315be098f602219901007abfa0937412b5ca46d8680266e945 - Sigstore transparency entry: 1317375762
- Sigstore integration time:
-
Permalink:
ZdekPyPi/DateUts@1fb3bb19a8ea6713b9d928d989a090d2e3bb9d41 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/ZdekPyPi
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
deploy.yml@1fb3bb19a8ea6713b9d928d989a090d2e3bb9d41 -
Trigger Event:
push
-
Statement type: