norminette
This commit is contained in:
@@ -1,16 +1,29 @@
|
||||
import datetime as dt
|
||||
import time as tm
|
||||
|
||||
# https://docs.python.org/3.10/library/datetime.html?highlight=time#datetime.datetime
|
||||
now = dt.datetime.now()
|
||||
epoch = dt.datetime(1970, 1, 1)
|
||||
|
||||
# # for memory
|
||||
# epoch = dt.datetime(1970, 1, 1)
|
||||
# delta = now - epoch
|
||||
# deltaInSeconds = delta.total_seconds()
|
||||
|
||||
# https://docs.python.org/3.10/library/datetime.html?highlight=time#strftime-and-strptime-behavior
|
||||
formatDate = now.strftime("%b %d %Y")
|
||||
format_date = now.strftime("%b %d %Y")
|
||||
|
||||
delta = now - epoch
|
||||
epoch_delta_in_seconds = tm.time()
|
||||
|
||||
deltaInSeconds = delta.total_seconds()
|
||||
deltaInSecondsStr = "{:,.3f}".format(float(deltaInSeconds))
|
||||
deltaInScientificStr = "{:.2e}".format(float(deltaInSeconds))
|
||||
# str.format https://docs.python.org/3.10/library/string.html#formatstrings
|
||||
epoch_delta_in_seconds_str = "{:,.4f}".format(epoch_delta_in_seconds)
|
||||
epoch_delta_in_scientific_str = "{:.2e}".format(epoch_delta_in_seconds)
|
||||
|
||||
print("Seconds since January 1, 1970: " + deltaInSecondsStr + " or " + deltaInScientificStr + " in scientific notation\n" + formatDate)
|
||||
print(
|
||||
"Seconds since January 1, 1970: ",
|
||||
epoch_delta_in_seconds_str,
|
||||
" or ",
|
||||
epoch_delta_in_scientific_str,
|
||||
" in scientific notation\n",
|
||||
format_date,
|
||||
sep=""
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user