2018-12-13
let today = Date()
let dateFormatter = DateFormatter()
dateFormatter.dateFormat = "yyyy-MM-dd EE"
dateFormatter.locale = Locale(identifier: "ko_KR")
print(dateFormatter.string(from: today))
2018. 12. 13(목)
dateFormatter.dateFormat = "yyyy. MM. dd(EE)"
기타
let df = DateFormatter()
// df.dateFormat = "yyyy-MMMM"
df.dateFormat = "yyyy. MM. dd(EE)"
df.locale = Locale(identifier: "ko_KR")
7일전 날짜 저장
let aWeekAgo : Double = Date().timeIntervalSince1970 - (7 * 60 * 60 * 24)
GS.s.periodStartDate = Date(timeIntervalSince1970: aWeekAgo)
//----------------------
let dt : Date = GS.s.periodStartDate ?? Date()
let dateFormatter = DateFormatter()
dateFormatter.timeZone = TimeZone(abbreviation: "KST")
dateFormatter.dateFormat = "yyyy-MM-dd HH:mm:ss"
dateLabel.text = dateFormatter.string(from: dt)
swift date to string
'[진행] {BE} Python 3.1x' 카테고리의 다른 글
UITabBar 크기 조정 (0) | 2020.06.30 |
---|---|
Making mater-detail app to hadle imageView (0) | 2020.06.23 |
버튼에서 밑 줄 없애기 underlineStyle... setTitle 대신 setAttributedTitle 이용 (2) | 2020.06.23 |
Alamofire SwiftyJSON (0) | 2020.06.23 |
log 출력 (0) | 2020.06.23 |
최근댓글