0
0

More than 3 years have passed since last update.

KotlinでFirestoreのTimestampをDate型に変換

Posted at

Firestoreで取得したTimestampを、Kotlinで扱うためにDate型に変換します。
簡単です。

MainActivity.kt
//FirestoreのドキュメントからTimestampデータを取り出す
val firebase_timestamp = document.data["timestamp"] as com.google.firebase.Timestamp
//Date型へ変換する
val date = firebase_timestamp.toDate()
0
0
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
0
0