search

Home  >  Q&A  >  body text

date - iOS 时间计算,月数间隔

iOS开发中如何获取某三个月之间的秒数,主要现在有个需求,要得到个时间间隔,要求起始时间为现在的时间点,终止时间为某些月后的这个时间点。有没有什么方法,难道必须要做判断吗,什么闰月之类的!!!

iOS是否有原生的方法啊?T__T

怪我咯怪我咯2773 days ago535

reply all(3)I'll reply

  • PHPz

    PHPz2017-04-17 17:16:10

    There is no native method from Apple to get this time point after a certain month. There is an open source library on Github that helps with date calculation
    https://github.com/DanisFabric/DateSuger You can check it out

    reply
    0
  • 怪我咯

    怪我咯2017-04-17 17:16:10

    NSCalendar

    reply
    0
  • 迷茫

    迷茫2017-04-17 17:16:10

    I would like to recommend you a commonly used time processing library in open source libraries - DateTools, which can accomplish almost everything you want.
    If you are interested, you can refer to how it is implemented.
    github address: https://github.com/MatthewYork/DateTools

    reply
    0
  • Cancelreply