【问题标题】:NSTimeInterval in UTC?UTC 中的 NSTimeInterval?
【发布时间】:2012-02-03 00:15:31
【问题描述】:

我正在使用以下代码计算当前时间间隔:

NSTimeInterval tInt=[[NSDate date] timeIntervalSince1970];
int tInterval=(int)tInt;

这个时间戳是UTC时间吗?

我需要 UTC 时间的 NSTimeInterval。

请帮忙

【问题讨论】:

    标签: iphone nsdate utc gmt nstimeinterval


    【解决方案1】:

    NSTimeInterval 是一个时间间隔,如 5 秒、2 小时、3 天等,它不是“时区”时间,而是两个时间点之间的相对时间。

    我不确定您到底在寻找什么,但请查看 Apple's doc for using timezones

    【讨论】:

    • 为了某些数据库目的,我必须使用时间戳(转换为 utc 时间)。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2012-12-11
    • 2011-12-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-10-04
    • 1970-01-01
    相关资源
    最近更新 更多