I ve got two NSDate,date and time. 我愿以我从日期和时间出发的方式补充这些内容。 关于我如何这样做的任何建议?
卡车
Nik
I ve got two NSDate,date and time. 我愿以我从日期和时间出发的方式补充这些内容。 关于我如何这样做的任何建议?
卡车
Nik
Use NSCalendar
s components:fromDate:
to get the components of the two dates.
Then reassemble them as needed using dateFromComponents:
.
如果我获得<代码>NSDates-dateByAddingtime Interval:
与-time IntervalSinceDate:
是你所期待的。
hth
–f
I ve got two NSDate,date and time.
象你这样说的错了。
国家可持续发展局是一个具体的时刻(自古时代以来的X秒)。 可持续发展协会不单纯是“xo clock”或“日历上的日期”,而你不应试图将其合并,因为《发展权利宣言》等影响可能会使你的计算错误(在某些时间区,有些日期是2-0小时,有些日期是2:00小时)。
考虑使用NSDatePicker或UIDatePicker(酌情)使用户从单一地点进入日期和时间。 这不仅使你更容易这样做,而且也使结果更加正确。
如果你从档案或类似来源分别读取两件,而你不控制格式(因此,你可以命令制作方以一个价值点放出日期),你需要做两件事之一:
在可能的情况下,将这两条插图结合起来。 例如,ISO 8601日期(例如,“2010-05-10”)和ISO 8601时间(例如,“23:20:19-0700”)可与“T”相加,以形成一个有效、完全具体的ISO 8601日期(“2010-05-10T23:20:19-0700”)。 然后,你可以把这一单体传给经过适当配置的NSDateFormatter。
如果出于某种原因,你能够把扼杀物混为一谈,将其 par灭,并填写一份单一的国家SDateComponents物体。
这不是令人愉快的,但正确性很重要,而只是每年只有几小时的两小时,只有某些用户才会mad。
目标是生产一个完全说明相关日期和时间的NSDate物体。 这是确保你在所有情况下都获得正确NSDate值的唯一途径。
I ve got the problem when I tried to do asynchronous requests to server from background thread. I ve never got results of those requests. Simple example which shows the problem: @protocol ...
i have a void, like -(void) doSomething in a specific controller. i can call it in this controller via [self doSomething], but i don t know how to call this void from another .m file. I want to call ...
Is there any way to obfuscate Objective-C Code ? Thanks
Created a View based Project and added a contact to the AddressBook using ABAddressBookRef,ABRecordRef now i wanted to display the added contact ABPersonViewController is the method but how to use in ...
I m pretty new to the Objective-C world and I have a long history with .net/C# so naturally I m inclined to use my C# wits. Now here s the question: I feel really inclined to create some type of ...
I have a simple Core Data app which displays a list of entities in the main window. To create or add new entities, I use a second modal window with a separate managed object context so changes can be ...
I m trying to show a database information in a tableview and then the detailed information in a view my problem is as follow: I created a NSMutableArray: NSMutableArray *myArray = [[NSMutableArray ...
I am writing an iPhone application which requires the user to enter several values that may contain a decimal point (currency values, percentages etc.). The number of decimal places in the values ...