Design Architecture for Utility Functions #2
1 changed files with 11 additions and 0 deletions
11
utils/date_utils.py
Normal file
11
utils/date_utils.py
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
from datetime import datetime
|
||||||
|
|
||||||
|
|
||||||
|
def get_current_date():
|
||||||
|
"""Returns the current date as a string in YYYY-MM-DD format."""
|
||||||
|
return datetime.now().strftime('%Y-%m-%d')
|
||||||
|
|
||||||
|
|
||||||
|
def format_date(date, format='%Y-%m-%d'):
|
||||||
|
"""Formats a given date to the specified format."""
|
||||||
|
return date.strftime(format)
|
||||||
Loading…
Add table
Add a link
Reference in a new issue