swift 현재날짜 (1) 썸네일형 리스트형 [Swift] 현재 날짜 및 시간 출력하기 Date(), DateFormatter() Date() 현재 날짜 및 시간을 알려주는 Date() print(Date()) 2019-07-05 08:11:58 +0000 Date()를 출력하면 다음과 같이 날짜와 시간이 출력됩니다. DateFormatter() "연도만 출력하고 싶다" 또는 "시간만 알고 싶다"와 같이 특정 값만 출력하고 싶을 경우 DateFormatter()를 통해 원하는 값을 얻을 수 있습니다. var formatter = DateFormatter() formatter.dateFormat = "yyyy-MM-dd HH:mm:ss" var current_date_string = formatter.string(from: Date()) print(current_date_string) 2019-07-05 17:25:18 var for.. 이전 1 다음