2

I want to convert my date Object to Unix time stamp.

  // "**strSellTime**"  has  the string of my date

 NSDateFormatter *dateFormatter=[NSDateFormatter new];

 [dateFormatter setDateFormat:@"EEEE MMM yyyy-MM-dd hh:mm:ss a"];

 NSDate *date=[dateFormatter dateFromString:strSellTime];

and wants to convert this date to UNIX time stamp like (1395382740) in this format.

halfer
  • 19,824
  • 17
  • 99
  • 186
Balu
  • 1,069
  • 2
  • 10
  • 24
  • Possible duplicate of [How to convert NSDate into unix timestamp iphone sdk?](http://stackoverflow.com/questions/2997062/how-to-convert-nsdate-into-unix-timestamp-iphone-sdk) – Suragch Jan 12 '17 at 02:11

2 Answers2

2

Just use [(NSDate*)date timeIntervalSince1970]

ThomasHaz
  • 527
  • 4
  • 16
2

time_t unixTime = (time_t) [date timeIntervalSince1970];

was able to solve it by this

Balu
  • 1,069
  • 2
  • 10
  • 24