-4

Can anyone please help me converting current date to this format:

"2017-06-15T05:15:31.158Z".

I need this format only, another format is not acceptable to my backend.

Friend, please help me here.

micstr
  • 5,080
  • 8
  • 48
  • 76
Jitendra
  • 21
  • 4

1 Answers1

0

try this

let formatter = NSDateFormatter()
formatter.dateFormat = "yyyy-MM-dd HH:mm:ss"
let timeString = formatter.stringFromDate(NSDate())
print(timeString) 

How to get yyyy-mm-dd hh:mm:ss format from "2015-06-26T00:10:00+01:00" in swift

junaidsidhu
  • 3,539
  • 1
  • 27
  • 49