【发布时间】:2024-01-23 14:03:01
【问题描述】:
如何获得“一周前”的 UNIX 时间戳?目前我这样做:
import Data.Time
...
oneWeekAgo = toTimestamp . addDays (-7) <$> now
where now = utctDay <$> getCurrentTime
toTimestamp = formatTime defaultTimeLocale "%s"
但这不起作用,因为 formatTime 返回一个 empty 字符串。
【问题讨论】: