FirebaseのTimeStampあれこれ[忘備録]


FirebaseのTimeStampをswiftであれこれ

func chancgeFirebaseTime(date:Date){
      let formatter = DateFormatter()

      formatter.dateStyle = .medium
      formatter.timeStyle = .short
      formatter.locale = Locale(identifier: "ja_JP")
      print(formatter.string(from: date))//2020/00/00 00:00
  }
let serverTime = "firebaseで取得してきたTimeStamp型を配置".dateValue()//To date type
chancgeFirebaseTime(date: serverTime)

ちなみにカスタム出来ます↓

  • .dateStyle
  • .timeStyle
  • .locale

編集途中です、、