Advertisement
Zekrommaster110

datetime format function

Aug 10th, 2017
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.25 KB | None | 0 0
  1. def _format_time(t):
  2.     def _beautify(inp):
  3.         return "0" + str(inp) if inp < 10 else str(inp)
  4.     return "%s.%s.%s - %s:%s:%s" \
  5.            % (_beautify(t.day), _beautify(t.month), t.year, _beautify(t.hour), _beautify(t.minute), _beautify(t.second))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement