일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | ||||
4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 | 12 | 13 | 14 | 15 | 16 | 17 |
18 | 19 | 20 | 21 | 22 | 23 | 24 |
25 | 26 | 27 | 28 | 29 | 30 | 31 |
Tags
- 아이맥
- WebService
- c#
- 오브젝티브C
- 윈도우즈7
- windows
- windows7
- WSDL
- 볼링
- 윈도구
- install
- 아이폰
- 링크
- cagr48com
- screen
- ObjectiveC
- 퇴사
- iPhone
- Number
- java
- mac
- VISTA
- Objective-C
- 7932
- 맥
- 형식
- 설치
- 애플
- Mobile
- 윈도구7
Archives
- Today
- Total
A colossal Dreamer: GR鐵塔-天生我材
Swift: getting Date Components 본문
Swift 실행환경에서 날짜 성분 출력하는 예제
import Foundation
let now = Date()
let calendar = Calendar.current
print("era:", calendar.component(.era, from: now))
print("year:", calendar.component(.year, from: now))
print("yearForWeekOfYear:", calendar.component(.yearForWeekOfYear, from: now))
print("quarter:", calendar.component(.quarter, from: now))
print("month:", calendar.component(.month, from: now))
print("weekOfYear:", calendar.component(.weekOfYear, from: now))
print("weekOfMonth:", calendar.component(.weekOfMonth, from: now))
print("weekday:", calendar.component(.weekday, from: now))
print("weekdayOrdinal:", calendar.component(.weekdayOrdinal, from: now))
print("day:", calendar.component(.day, from: now))
print("hour:", calendar.component(.hour, from: now))
print("minute:", calendar.component(.minute, from: now))
print("second:", calendar.component(.second, from: now))
print("nanosecond:", calendar.component(.nanosecond, from: now))
print("calendar:", calendar.component(.calendar, from: now))
print("timeZone:", calendar.component(.timeZone, from: now))
더보기
era: 1
year: 2022
yearForWeekOfYear: 2022
quarter: 0 < - 분기 구현안됨. The quarter unit is largely unimplemented, and is not recommended for use.
month: 7
weekOfYear: 30 <- 1년중에 30주차
weekOfMonth: 4 <- 넷째 주 그러나 수요일 기준의 넷째 주 아님에 유의하기
weekday: 2 <- 월요일(2) / 1은 일요일
weekdayOrdinal: 3 <- 바로 위 weekday(월요일) 기준으로 7월의 세 번째 월요일
day: 18
hour: 11
minute: 42
second: 23
nanosecond: 268340945
calendar: 9223372036854775807
timeZone: 9223372036854775807
'Development > 아이폰' 카테고리의 다른 글
swift playground with cocoapods (0) | 2022.09.07 |
---|---|
remove files from tracking git (0) | 2022.09.07 |
Swift PropertyWrapper (0) | 2022.07.11 |
WWDC2022 Platforms State of Unions 복습 정리 (0) | 2022.06.23 |
SwiftPlantUML - Swift코드로부터 PlantUML class diagram 뽑아재끼기 (0) | 2022.06.21 |