Skip to content

Commit

Permalink
add function documentation to date_to_unix.py
Browse files Browse the repository at this point in the history
  • Loading branch information
toravest committed May 23, 2025
1 parent caa592f commit b828e3c
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions src/my_package/date_to_unix.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@
import time

def get_unix_timestamp():
'''
This function will make the user input a start_date and end_date, then return a unix timestamp.
The user get asked to input in this format: yyyy, mm, dd, hh, mm. But if the user only insert
yyyy, mm, dd. The function will say the hour is 00, the same with minutes.
'''

start_date_input = input("Choose a start date (yyyy, mm, dd, hh, mm): ")
end_date_input = input("Choose an end date (yyyy, mm, dd, hh, mm): ")

Expand Down Expand Up @@ -49,11 +55,16 @@ def get_unix_timestamp():
return unix_start, unix_end

def from_unix_timestamp(unix_start, unix_end):
'''
This function will take in the parameters unix_start, unix_end, and then convert from unix
timestamp to the inserted: yyyy, mm, dd, hh, mm
'''

start_from_unix = datetime.datetime.fromtimestamp(unix_start)
end_from_unix = datetime.datetime.fromtimestamp(unix_end)

return start_from_unix, end_from_unix




# This prints the documentation for the functions written inside '''these'''
print(get_unix_timestamp.__doc__)
print(from_unix_timestamp.__doc__)

0 comments on commit b828e3c

Please sign in to comment.