i am trying to use nsdateformatter and return a time set by NSTimeZone, but the output resets to GMT 0000, how can i return to the set timezone. it returns fine if i convert it from stringToDate. this only happens when i try and output it from datetoString
let now = NSDate()
let timezoneLK = NSTimeZone(forSecondsFromGMT: 19800)
var formatter = NSDateFormatter()
formatter.timeZone = timezoneLK
formatter.dateStyle = NSDateFormatterStyle.LongStyle
formatter.timeStyle = NSDateFormatterStyle.LongStyle
let localDate = formatter.stringFromDate(now)
let dateFrom = formatter.dateFromString(localDate)
println("\(dateFrom)")
what am i missing, please help. i need to return a NSDate not a string.
for example the input time is (2015-06-29 15:34:28) this is the time at GMT +5:30, when i output the time with dateFromString it shows as (2015-06-29 10:03:31 +0000) is there a way to around it that it shows the NSDate as (2015-06-29 15:34:28).