9
9

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

CoreData経由でsqliteに保存した日付データをunixtimeに変換する

Last updated at Posted at 2013-12-11

CoreData+sqliteでNSDateオブジェクトを永続化すると、sqlite上では2001/1/1 00:00:00GMT (unixtime=978307200)を基点とした秒数がtimestamp型で保存される。

NSDate#timeIntervalSinceReferenceDateを内部で使ってるんでしょうかね。

なので.sqliteから直接日付を取り出して確認したい場合は

978307200 + (timestamp) = unixtime

でOK

###2015-02-05追記###
全CoreData使いが幸せになれるツールをご用意しました。
http://kenmaz.net/tools/unixtime.html

9
9
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
9
9

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?