Xcode swift am/pm time to 24 hour format

后端 未结 11 1134
甜味超标
甜味超标 2020-11-28 04:40

I am trying to convert a am/pm format time to a 24 hour format time

6:35 PM to 18:35

I tried this piece of code on playground but it doesnt

11条回答
  •  忘掉有多难
    2020-11-28 05:31

    let calendar = Calendar.current
    let hours    = calendar.component(.hour, from: Date())
    let minutes  = calendar.component(.minute, from: Date())
    let seconds  = calendar.component(.second, from: Date())
    

提交回复
热议问题