[Swift]デバイスの時刻取得

デバイスの時刻取得

private func getDeviceDatetimeString() -> String{
    let date:NSDate = NSDate(timeIntervalSinceNow:NSTimeInterval(NSTimeZone.systemTimeZone().secondsFromGMT))
    var form:NSDateFormatter = NSDateFormatter()
    form.calendar = NSCalendar(calendarIdentifier: NSGregorianCalendar)
    form.dateFormat = "yyyy-MM-dd HH:mm:ss"
    form.timeZone = NSTimeZone(forSecondsFromGMT: 0)
    form.locale = NSLocale(localeIdentifier: "en_US_POSIX")
    return form.stringFromDate(date)
}