how to add time in current time

后端 未结 4 2223
清歌不尽
清歌不尽 2021-02-14 07:01

I\'m quite confused about this one.

I want to grab, current time, than according to condition, I want to add the required time, to the current time. for example.

4条回答
  •  南方客
    南方客 (楼主)
    2021-02-14 07:58

    Swift version:

    let now = NSDate().timeIntervalSince1970 // current time
    let timeAfterXInterval = NSDate().dateByAddingTimeInterval(XXX).timeIntervalSince1970 // time after x sec
    

    XXX is time in sec

提交回复
热议问题