Hi, I'd like to write a function that extracts the date from a DateTime object
returns a new DateTime object with that date but time set to 00:00:00. The
input will be in unixtime due to other requirements. When I use the following
func test(unixTime: int64): bool =
let t1 = local(fromUnix(unixTime))
# let t = initDateTime(t1.monthday, t1.month, t1.year, 0, 0,
0).toTime.toUnix
Run
local() leads to side effects. Using instead
parse(format(fromUnix(unixTime), "yyyy-MM-dd"), "yyyy-MM-dd").toTime.toUnix
Run
also leads to side effects and is slower anyways.
Is there a way to circumvent these side effects such that I can use a func
instead of proc? Thanks!