I have two user selected dates: startDate and endDate. They are NSDate instances and I have to send them as parameters as NSNumbers. How can I convert them to NSNumber with seconds?
How to send NSDate with a certain date format as NSNumber? i.e convert NSDate to NSDate with another format?
441 views Asked by AbdulAziz Rustam Ogli At
3
There are 3 answers
0
On
If you mean a timestamp format NSDate *date = [NSDate date]; NSTimeInterval ti = [date timeIntervalSince1970]; How to convert NSDate into Unix timestamp in Objective C/iPhone?
Thanks,
1) First, get the date in
MM/dd/yyyyformat:2) get string date and remove '/' from it:
3) Use
NSNumberFormatterfrom convertingNSStringtoNSNumber:Hope, this is what you want!