Created
November 25, 2025 05:10
-
-
Save harryworld/298384a1e5705dbbd2ade92e9e719d10 to your computer and use it in GitHub Desktop.
SwiftDate questions
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import Foundation | |
| import Playgrounds | |
| import SwiftDate | |
| #Playground { | |
| let calendar = Calendar.current | |
| let fastMidnight = calendar.dateComponents([.year, .month], from: Date()) | |
| let date = DateInRegion().dateAt(.startOfDay).date | |
| date + 1.hours | |
| /// 1. 如何使用 SwiftDate 取得今天的日期並格式化為 'yyyy-MM-dd 格式?" | |
| /// 2. 如何計算兩個日期之間的天數差異? | |
| let date1 = Date(timeIntervalSince1970: 1_764_036_000) | |
| let date2 = Date(timeIntervalSince1970: 1_764_043_200) | |
| /// 3. 如何將一個日期加上 3 天並取得新的日期? | |
| /// 4. 如何判斷一個日期是否在本週內? | |
| /// 5. 如何使用 SwiftDate 時間區功能取得當前時區? | |
| /// 6. 如何將一個日期轉換為不同的時區? | |
| /// 7. 如何使用 SwiftDate 取得本月的第一天和最後一天? | |
| /// 8. 如何比較兩個日期並判斷哪一個較早? | |
| /// 9. 如何使用 SwiftDate 取得昨天的日期? | |
| /// 10. 如何將一個日期格式化為 'EEEE, MMM d, yyyy' 的字串? | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment