문제

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.

도움이 되었습니까?

해결책 2

time_t unixTime = (time_t) [date timeIntervalSince1970];

was able to solve it by this

다른 팁

Just use [(NSDate*)date timeIntervalSince1970]

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top