So my goal is to convert the time from an NSDate to an integer however, I am unsure of how to go about this. I have tried doing a simple conversion such as Int(...) however it does not work. Is this due to the fact that the string includes AM or PM? I would really appreciate any help towards trying to get the time to be an integer. Thank you.
var firstDate = DateFormatter.localizedString(from: NSDate() as Date, dateStyle: DateFormatter.Style.none, timeStyle: DateFormatter.Style.short)
This is generated in the view did load section. Again any help would be very much appreciated, thank you.
EDIT:
Sorry reading over the question it probably was not particularly clear as to what I'm after. I want to be able to find the difference in time between two different NSDates. This will further be used as a countdown feature. The problem associated with this is that I am unsure of exactly how I am going to subtract two strings. Therefore I figured that if I can change the hours, minutes and seconds to integers, I could then subtract them. What I need assistance with is any way which I can achieve this. Perhaps changing the values to intervals is a bad way of doing this but it was just a thought I had and am open to any suggestions.