I want date to be on 2 lines
public func smdt(date:NSDate)->NSString{
var dateFormatter = NSDateFormatter()
dateFormatter.dateFormat = "h:mma dd MMMM yyyy"
return dateFormatter.stringFromDate(date)
}
I add time in string, but I want to start new line before "dd"
Example: h:mma\ndd MMMM yyyy
Should be:
7:12PM
19 May 2015
In .dateFormat
, \n
doesn't work... The only way to be done is to detect where is the first whitespace between PM and 19 and replace it with \n
. How it can be done ?
It has to work on every timezone on the earth. That means I can't use AM/PM for separating...