0

I have a date from a date picker, I need to make it a unix timestamp, I log it but get a wrong value,

here my code:

time_t unixTime = (time_t) [self.datePicker.date timeIntervalSince1970];

    NSLog(@"el timestamp:: %lo", unixTime);

this is the log

2012-06-01 22:13:18.543 ClientApp[50494:12503] escojio ::2012-06-01 12:12:16 +0000
2012-06-01 22:14:13.163 ClientApp[50494:12503] el timestamp:: 11762137660

I go to a timestamp calculator and get a completely wrong time, do i have to format it in some way?,

so what im I doing wrong?

thanks!

4

1 に答える 1

3

フォーマット指定子は%lo、8 進数で数値を出力します。同じ表記の Unix タイムスタンプと比較してよろしいですか?

11762137660(10 月) == 1338556336(12 月)、これは今日にぴったりです。

于 2012-06-01T12:27:40.963 に答える