更改当前日期 [英] Changing the current date

查看:58
本文介绍了更改当前日期的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在iPhone开发中处理日期。我需要将日期从当前日期起增加24小时。

I am working with the date in my iPhone development. I need to increase the date by 24 hours from the current date.

推荐答案

您可以使用dateByAddingTimeInterval

You can use dateByAddingTimeInterval

NSDate *currentDate = [NSDate date];
NSDate *datePlusOneDay = [currentDate dateByAddingTimeInterval:(60 * 60 * 24)]; //one day

这篇关于更改当前日期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆