Skip to main content

Shyna Backend Functionality Package For Time manipulation

Project description

Shyna Time Package

Suggested: NOT TO USE

ShynaTime Package for call time manipulation needed by Shyna and to maintain the default and standard date and time application wide. The Package is still under development and new methods and functions will be added as per Shyna's processing needs.

Class have the following methods in the class by far:

  • add_date
  • add_hour
  • add_min
  • alternative
  • check_am_pm
  • daily
  • get_date_and_time
  • get_day_of_week
  • get_weekdays
  • is_time_passed
  • now_date
  • now_time
  • string_to_date
  • string_to_time
  • string_to_time_with_date
  • subtract_date
  • subtract_hour
  • subtract_min
  • time_digit
  • weekends
  • get_date_and_time_for_alarm
  • get_date_and_time
  • convert_to_am_pm
from Shynatime import ShTime

st = ShTime.ClassTime()

# 24-hour time format: 19:34:18 <class 'str'>
print(st.now_time, type(st.now_time))

# yyyy-mm-dd date format: 2021-12-20 <class 'datetime.date'>
print(st.now_date, type(st.now_date))

# subtract hours: 17:34:18 <class 'datetime.time'>
print(st.subtract_hour(from_time=st.now_time, how_many=2), type(st.subtract_hour(from_time=st.now_time, how_many=2)))

# subtract days: 2021-12-18 00:00:00 <class 'datetime.datetime'>
print(st.subtract_date(from_date=st.now_date, how_many=2), type(st.subtract_date(from_date=st.now_date, how_many=2)))

# add time: 21:54:52 <class 'datetime.time'>
print(st.add_hour(from_time=st.now_time, how_many=2), type(st.add_hour(from_time=st.now_time, how_many=2)))

# add date: 2021-12-22 00:00:00 <class 'datetime.datetime'>
print(st.add_date(from_date=st.now_date, how_many=2), type(st.add_date(from_date=st.now_date, how_many=2)))

# string to date format: 2021-12-20 <class 'datetime.datetime'>
print(st.string_to_date(date_string=str(st.now_date)), type(st.string_to_date(date_string=str(st.now_date))))

# string to time format: 20:01:16 <class 'datetime.datetime'>
print(st.string_to_time(time_string=str(st.now_time)), type(st.string_to_time(time_string=str(st.now_time))))

# get day of the week: 0 <class 'str'> 0 as Monday and 6 as Sunday
print(st.get_day_of_week(), type(st.get_day_of_week()))

# add minutes to the time: 19:10:33 <class 'datetime.time'>
print(st.add_min(from_time=st.now_time, how_many=3), type(st.add_min(from_time=st.now_time, how_many=3)))

# string to time with date value: 1900-01-01 19:14:02 <class 'datetime.datetime'> the date will be always 1900-01-01
print(st.string_to_time_with_date(st.now_time), type(st.string_to_time_with_date(st.now_time)))

# Get tomorrow's date: 2021-12-22 00:00:00 <class 'datetime.datetime'>
print(st.daily(), type(st.daily()))

# Get date of upcoming weekend (Saturday/sunday): 2021-12-25 <class 'datetime.date'>
print(st.weekends(), type(st.weekends()))

# Get date of upcoming weekend (Saturday/sunday) from a specific date. Date should be in string: 2022-01-01 <class
# 'datetime.date'>
print(st.upcoming_weekends_from_specific_date(string_date="2021-12-27"),type(st.upcoming_weekends_from_specific_date(string_date="2021-12-27")))

# Get date of upcoming weekday (NOT Saturday/Sunday): 2021-12-22 00:00:00 <class 'datetime.datetime'>
print(st.get_weekdays(), type(st.get_weekdays()))

# Check if the time is passed or not. It follows 24-hour clock format: False <class 'bool'>
print(st.is_time_passed(item_time='23:00:00'), type(st.is_time_passed(item_time='23:00:00')))

# check if am/pm is there in the string: if not False otherwise returns am/pm as per string
print(st.check_am_pm(text_string='7 '), type(st.check_am_pm(text_string='7 ')))

# return if there is a digit in the sentence. if not it returns False
print(st.time_digit(text_string='together 7'), type(st.time_digit(text_string='together 7')))

# return possible upcoming time: if today 7 PM is over it will return tomorrow's 7 PM in case PM is not mention then it will return 7 AM.: (True, '2021-12-22', '06:00:00') <class 'tuple'>
# best for setting alarm: sent the string and return alarm set time and date as tuple
print(st.get_date_and_time(text_string='Wake me up 6 am'), type(st.get_date_and_time(text_string='wake me up at 6 am')))


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

ShynaTime-0.15.tar.gz (5.1 kB view details)

Uploaded Source

Built Distribution

ShynaTime-0.15-py3-none-any.whl (5.3 kB view details)

Uploaded Python 3

File details

Details for the file ShynaTime-0.15.tar.gz.

File metadata

  • Download URL: ShynaTime-0.15.tar.gz
  • Upload date:
  • Size: 5.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.8.10

File hashes

Hashes for ShynaTime-0.15.tar.gz
Algorithm Hash digest
SHA256 73dea9faf54fd0c81f2e2d4fb2b691fffbce834e20fc6beca9b1644d185d6d12
MD5 8a748b4501e5910fc9e4f648ba210f73
BLAKE2b-256 70f5b7a05f04c0fe311905f685df227b41511de219475d4d0e4c27fe80c473f8

See more details on using hashes here.

File details

Details for the file ShynaTime-0.15-py3-none-any.whl.

File metadata

  • Download URL: ShynaTime-0.15-py3-none-any.whl
  • Upload date:
  • Size: 5.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.8.10

File hashes

Hashes for ShynaTime-0.15-py3-none-any.whl
Algorithm Hash digest
SHA256 008578d5018b54f9d72fe5e865fb6c29302085bf389bae2135ef6d2aa338a929
MD5 5fae5d85d68c59b996d4b19a602183fb
BLAKE2b-256 7ef470d33a908df125939ca066df9a1cc3d2ceda5384b840259484af1e00e170

See more details on using hashes here.

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