Skip to main content

Date Master

Project description

=======================

This is a project that helps you to manage and display your entered date based on your requirement. Here I listed the use cases of date_master

1)  Get the current date 
2)  Get the date 'n' days before and after from the current date 
3)  Change the order of date 
        Eg: dd/mm/yyyy to yyyy/mm/dd
4)  Change the format of your date(integer to string or string to interger)
        Eg: 31/8/2022 to 31/August/Two Thousand and Twenty Two
5)  Change the split value
        Eg: 31 / 8 / 2022 to 31 | 8 | 2022

Parameters

1)  date = Date that you have entered(value type = Integer)
2)  order = Specifies the order of your date that you want to display(value type = String)
3)  format = Specifies the format of your date that you want to display string(str) or integer(int)(value type = String)
4)  split_by = Specifies the split value(value type = String)

General constraints

1)  beautiful_date param must be a dict of values
2)  'date' is a mandatory param for all your request in dd,mm,yyyy format

Installing

pip install date-master

Usage

from date_master.date import beautiful_date

date = ['today'] or # current date
       ['today',2] or # date after 2 days from the current date
       ['today',-10] # date before 10 days from the current date

       [31, 8, 2022] or # Custom date
       [[31, 8, 2022],2] or # date after 2 days from the custom date
       [[31, 8, 2022],-10] or # date before 10 days from the custom date
       
order = ['DD','YYYY','MM']
format = ['int','str','str']
split_by = ['|']


params = {
    'date':date,
    'order':order,
    'format':format,
    'split_by':split_by
}

result = beautiful_date(params)
print(result)

Result
====================
>> 31| 'Two Thousand and Twenty Two'| 'August'

Usecase 1 :- Get the current date

Constraints : date contain a value that must be 'today'

date = ['today']

params = {
    'date':date
}

result = beautiful_date(params)
print(result)

Result
====================
>> [31, 8, 2022]

Usecase 2 :- Get date after 2 days from the current date

Constraints : date contain 2 value that must be 'today' and the number of days from current date

date = ['today', 2]

params = {
    'date':date
}

result = beautiful_date(params)
print(result)

Result
====================
>> [2, 9, 2022]

Usecase 3 :- Get date before 10 days from the current date

Constraints : date contain 2 value that must be 'today' and the number of days from current date. Second value must be negative integer

date = ['today', -10]

params = {
    'date':date
}

result = beautiful_date(params)
print(result)

Result
====================
>> [21, 8, 2022]

Usecase 4 :- Custom date

Constraints : date contain a value that must be your date

date = [31, 8, 2022]

params = {
    'date':date
}

result = beautiful_date(params)
print(result)

Result
====================
>> [31, 8, 2022]

Usecase 5 :- Get date after 2 days from the custom date

Constraints : date contain 2 value that must be your custom date and the number of days from that date

date = [[31, 8, 2022], 2]

params = {
    'date':date
}

result = beautiful_date(params)
print(result)

Result
====================
>> [2, 9, 2022]

Usecase 6 :- Get date before 10 days from the custom date

Constraints : date contain 2 value that must be your custom date and the number of days from that date. Second value must be negative integer

date = [[31, 8, 2022], -10]

params = {
    'date':date
}

result = beautiful_date(params)
print(result)

Result
====================
>> [21, 8, 2022]

Usecase 7 :- Changing the 'order' of date

Constraints : order list contain 3 values that must be 'dd','mm', and 'yyyy'

date = [31, 8, 2022]
order = ['YYYY','DD','MM']

params = {
    'date':date,
    'order':order
}

result = beautiful_date(params)
print(result)

Result
====================
>> [2022, 31, 8]

Usecase 8 :- Changing the date 'format'

Constraints : format contain 3 values that must be 'str' or 'int'

date = [31, 8, 2022]
format = ['int','str','str']

params = {
    'date':date,
    'format':format
}

result = beautiful_date(params)
print(result)

Result
====================
>> [31, 'August', 'Two Thousand and Twenty Two']

Usecase 9 :- Changing the 'split_by' value of date

Constraints : split_by contain a single value, it must be a string

date = [31, 8, 2022]
split_by = ['|']

params = {
    'date':date,
    'split_by':split_by
}

result = beautiful_date(params)
print(result)

Result
====================
>> [31| 8| 2022]

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

date_master-1.1.0.tar.gz (7.6 kB view hashes)

Uploaded Source

Built Distribution

date_master-1.1.0-py3-none-any.whl (7.9 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page