how to add time in current time

后端 未结 4 2031
梦如初夏
梦如初夏 2021-02-14 07:14

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:40

    Swift version:

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

    XXX is time in sec

提交回复
热议问题