kisa-utils 0.38.0__py3-none-any.whl → 0.39.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
kisa_utils/dates.py CHANGED
@@ -170,6 +170,20 @@ def dateFrom(date:str, days:int, hours:int=0) -> str:
170
170
  _date = datetime.datetime.strptime(date, '%Y-%m-%d')
171
171
  return str(_date + datetime.timedelta(days=days, hours=hours))[:10]
172
172
 
173
+ def TimeFrom(timestamp:str, days:int=0, hours:int=0, minutes:int=0, seconds:int=0) -> str:
174
+ '''
175
+ get the time thats `days` + `hours` + `minutes` + `seconds` from `timestamp`
176
+ Args:
177
+ timestamp(str): the reference timestamp to use, format is `YYYY-MM-DD HH:MM:SS`
178
+ days(int): days from the reference timestamp
179
+ hours(int): hours to include to the days to ge tthe new date
180
+ minutes(int): minutes to include to the days to ge the new date
181
+ seconds(int): seconds to include to the days to ge the new date
182
+ ```
183
+ '''
184
+ _tstamp = datetime.datetime.strptime(timestamp, '%Y-%m-%d %H:%M:%S')
185
+ return str(_tstamp + datetime.timedelta(days=days, hours=hours, minutes=minutes, seconds=seconds))
186
+
173
187
  def dateFromNow(days=0,hours=0) -> str:
174
188
  '''
175
189
  get the timestamp(not date) thats `days` + `hours` from the current time
@@ -186,6 +200,20 @@ def dateFromNow(days=0,hours=0) -> str:
186
200
  now = datetime.datetime.utcnow() + datetime.timedelta(hours=3.00)
187
201
  return str(now+datetime.timedelta(days=days, hours=hours))[:19]
188
202
 
203
+ def TimeFromNow(days:int=0, hours:int=0, minutes:int=0, seconds:int=0) -> str:
204
+ '''
205
+ get the time thats `days` + `hours` + `minutes` + `seconds` from `timestamp`
206
+ Args:
207
+ days(int): days from the reference timestamp
208
+ hours(int): hours to include to the days to ge tthe new date
209
+ minutes(int): minutes to include to the days to ge the new date
210
+ seconds(int): seconds to include to the days to ge the new date
211
+ ```
212
+ '''
213
+ timestamp = currentTimestamp()
214
+ return TimeFrom(timestamp, days, hours, minutes, seconds)
215
+
216
+
189
217
  # thanks to airtel & MTN strange date formats, we have this
190
218
  def standardizedDate(date:str, fmt:str=''):
191
219
  '''
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: kisa-utils
3
- Version: 0.38.0
3
+ Version: 0.39.0
4
4
  Summary: Utility functions and modules for KISA Developers
5
5
  Author: Tom Bukenya
6
6
  Author-email: glayn2bukman@gmail.com
@@ -2,7 +2,7 @@ kisa_utils/__init__.py,sha256=iXjGTol3UxJkh_cyISYEAY_yWC5ZlNvIRXFuuiHx76Q,621
2
2
  kisa_utils/cache.py,sha256=4Ue5G3QhHSQAmIfQKYgWKWjNL4rA4wLLd_RdBLb2ABY,7345
3
3
  kisa_utils/codes.py,sha256=PV_S53Skggf4XetOdYoIKtEmM8cpN5wZwUlxje70WZY,904
4
4
  kisa_utils/config.py,sha256=NfluzGKTh66qfNtC-Ae0zNb1XzMTgU2Me9Vi82R9c1E,2285
5
- kisa_utils/dates.py,sha256=kcNqoY_iguG9hSzABMIBqeL3MGz3n4MRIXuW4OxRHLs,12662
5
+ kisa_utils/dates.py,sha256=zxe4n0PdKReZjK5ZkvnCZtJ55lk5oqu9oS8VX_nLozw,13966
6
6
  kisa_utils/db.py,sha256=tVNMV-hc-oPxR4iRSX-d82Gi4fQwI5Cga1eP8SLvHFs,49202
7
7
  kisa_utils/encryption.py,sha256=nFzNpzWV_D9uSEq4FsgCnlS7FQtqWP9fvM_81rsfcLo,4218
8
8
  kisa_utils/enqueue.py,sha256=VIliaMvw4MUdOqts0dXdZCYNxs-QrOVjIRAR3scGrRM,11786
@@ -23,7 +23,7 @@ kisa_utils/servers/flask.py,sha256=o76cJKlQ3L8EOVdHUF092qwoAZMzgttuLt0mMhtCsGI,4
23
23
  kisa_utils/structures/__init__.py,sha256=JBU1j3A42jQ62ALKnsS1Hav9YXcYwjDw1wQJtohXPbU,83
24
24
  kisa_utils/structures/utils.py,sha256=665rXIapGwFqejizeJwy3DryeskCQOdgP25BCdLkGvk,2898
25
25
  kisa_utils/structures/validator.py,sha256=Y4UmB4TH7N-GkK22EV1WOsPWjTeqxVWLTentl1keZD4,4053
26
- kisa_utils-0.38.0.dist-info/METADATA,sha256=N9Rr0nesf9HuUFeg9N_nQgpZYO5YLOMhfOYax5vI3NA,477
27
- kisa_utils-0.38.0.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
28
- kisa_utils-0.38.0.dist-info/top_level.txt,sha256=URxY4sRuqmirOxWtztpVmPoGQdksEMYO6hmYsEDGz2Y,75
29
- kisa_utils-0.38.0.dist-info/RECORD,,
26
+ kisa_utils-0.39.0.dist-info/METADATA,sha256=M6VVyZ0NOG7urg1fPt48fHuxc85qD0keInyLNBq4LQY,477
27
+ kisa_utils-0.39.0.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
28
+ kisa_utils-0.39.0.dist-info/top_level.txt,sha256=URxY4sRuqmirOxWtztpVmPoGQdksEMYO6hmYsEDGz2Y,75
29
+ kisa_utils-0.39.0.dist-info/RECORD,,