Add helper function september_now so you can skip the now() call.
Especially so outsiders don't have to write the long call eternalseptember.september_string(eternalseptember.now(), ...) if they don't have their own now function.
This commit is contained in:
parent
beaa7a47e1
commit
2add4e4ec1
1 changed files with 4 additions and 1 deletions
|
@ -30,6 +30,9 @@ def september_day(date):
|
|||
days = diff.days + 1
|
||||
return days
|
||||
|
||||
def september_now(strf):
|
||||
return september_string(now(), strf)
|
||||
|
||||
def september_string(date, strf):
|
||||
'''
|
||||
Return the ES formatted string for this date.
|
||||
|
@ -46,4 +49,4 @@ def september_string(date, strf):
|
|||
return date.strftime(strf)
|
||||
|
||||
if __name__ == '__main__':
|
||||
print(september_string(now(), '%Y %B %d %H:%M:%S'))
|
||||
print(september_now('%Y %B %d %H:%M:%S'))
|
||||
|
|
Loading…
Reference in a new issue