测试已测试 | ✓ |
语言编程语言 | SwiftSwift |
许可证 | MIT |
发布日期最新发布 | 2017年10月 |
SwiftSwift版本 | 3.0 |
SPM支持SPM | ✓ |
由Naoto Kaneko维护。
Swift中的直观日期处理
版本 | Swift | iOS | macOS | tvOS | watchOS | 注意 |
---|---|---|---|---|---|---|
1.0.0+ | 3.0+ | 8.0+ | 10.9+ | 9.0+ | 2.0+ | 与0.6.x版本不兼容 |
0.6.0+ | 3.0+ | 8.0+ | 10.9+ | 9.0+ | 2.0+ | |
0.5.0+ | 2.3 | 8.0+ | 10.9+ | 9.0+ | 2.0+ |
Date(era: 235, year: 26, month: 8, day: 14, hour: 20, minute: 25, second: 43, nanosecond: 0, on: Calendar(identifier: .japanese))
Date(year: 2014, month: 8, day: 14, hour: 20, minute: 25, second: 43, nanosecond: 0)
Date(year: 2014, month: 8, day: 14, hour: 20, minute: 25, second: 43)
Date(year: 2014, month: 8, day: 14)
Date.today()
Date.yesterday()
Date.tomorrow()
now + 1.year
now - 2.months
now + (3.weeks - 4.days + 5.hours)
1.year.later
1.year.ago
now.changed(year: 2014)
now.changed(weekday: 1)
now.truncated([.minute, .second, .nanosecond])
now.truncated(from: .day)
now.string(inDateStyle: .long, andTimeStyle: .medium)
now.dateString(in: .medium)
now.timeString(in: .short)
3.days.string(in: .full)
"2014/8/14".date(inFormat: "yyyy/MM/dd")
"2014-08-14T20:25:43+0900".dateInISO8601Format()
Chronograph可在MIT许可证下使用。有关更多信息,请参阅LICENSE文件。