I have some objective-c code I’m converting from iPhone to iPad. CFGregorianDate is used throughout for date functions. I have never used it, preferring to use NSDate.
I want to take the date and format it so I get the full month name, using the format string “MMMM”, which I don’t seem to be able to do using CFGregorianDate.
What’s the difference between the two, and does it make any difference in usage?
From the docs:
So, no difference in usage, really. The main difference is that CFDate and its subclasses are legacy types.However, as has been pointed out,
CFGregorianDateis extremely different fromCFDate. It doesn’t store a timestamp but rather the year, month, day, hour minute and second as separate integers.So your best bet is to create a method like
cfGregorianToNSDate:in which you parse these integers and construe a newNSDateobject.