mySpindel/LittleBock/nim/unixtimes.nim

20 lines
417 B
Nim

import std/strformat
import std/times
import strutils
let timestamps: seq[int64] = @[
161252911000,
162352411900,
1646927061000,
166691206100000
]
echo "formatted UNIX dates"
for i in timestamps:
var s: string = $i
if len(s) > 10: s = s[0 .. 9]
let datetime = times.fromUnix(parseInt(s))
let datetime_fmt = datetime.format("yyyy-MM-dd HH:mm:ss")
echo &" {s} : {datetime_fmt}"