Check out example codes for "swift string time to epoch". It will help you in understanding the concepts better.

Code Example 1

let date = NSDate() // current date
let unixtime = date.timeIntervalSince1970

Learn ReactJs, React Native from akashmittal.com