1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
from datetime import datetime

now = datetime.now().utctimetuple()

# example: 2018-345 12:15:17
print(
    "{}-{} {}:{}:{}".format(
        now.tm_year,
        now.tm_yday,
        now.tm_hour,
        now.tm_min,
        now.tm_sec,
    )
)