File: formatdate.py

package info (click to toggle)
vectorscan 5.4.11-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 12,864 kB
  • sloc: cpp: 150,782; ansic: 40,288; python: 620; sh: 32; makefile: 14
file content (18 lines) | stat: -rwxr-xr-x 317 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#!/usr/bin/env python

import os
import sys
import datetime

def usage():
    print("Usage:", os.path.basename(sys.argv[0]), "<seconds from epoch>")

if len(sys.argv) != 2:
    usage()
    sys.exit(1)

ts = sys.argv[1]

build_date = datetime.datetime.utcfromtimestamp(int(ts))

print(build_date.strftime("%Y-%m-%d"))