gpt4 book ai didi

ios - 时间戳中的日期变得错误

转载 作者:搜寻专家 更新时间:2023-11-01 05:48:23 24 4
gpt4 key购买 nike

<分区>

我正在尝试将时间戳转换为日期。但它返回错误的日期。

我有一个时间戳

1524637838000.0

根据此返回 25-04-2018 12:00 online converter

但是我在使用我的代码进行转换时得到了错误的日期

let date = Date(timeIntervalSince1970:1524637838000.0)
let dateFormatter = DateFormatter()
dateFormatter.dateFormat = "dd-MM-yyyy hh:mm"
let myDate = dateFormatter.string(from: date)
print("Date is = ",myDate)

我明白了

07-11-50283 12:03

作为结果。我的代码有什么问题吗?

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com