nim-theNewWeb/code/utils.nim

23 lines
712 B
Nim

# --==--==--==--==--==--==--==--==--==--==--==--==--==--==--==-- #
# Bruno Charest
# 2022-10-25
#
# __ DESCRIPTIONS __
# utils : procedures generals utils
#
# --==--==--==--==--==--==--==--==--==--==--==--==--==--==--==-- #
import std/times
# --==--==--==--==--==--==--==--==--==--==--==--==--==--==-- #
# PROC : Convert epoch millisecond time to human readable time
# --==--==--==--==--==--==--==--==--==--==--==--==--==--==-- #
proc convertEpochToHumanTime*(epochTime: int): string =
var humanTime: Time
var dateTime: string
humanTime = fromUnix(convert(Milliseconds, Seconds, epochTime))
dateTime = format(humanTime, "yyyy-MM-dd' 'HH:mm")
# echo dateTime
return dateTime