diff --git a/ProjectClock/Utils.swift b/ProjectClock/Utils.swift index 7f0f8bb..8eb5e01 100644 --- a/ProjectClock/Utils.swift +++ b/ProjectClock/Utils.swift @@ -16,4 +16,12 @@ extension Date f.dateFormat = "yyyy-MM-dd hh:mm:ss" return f.string(from: self) } + + /// Get year, month, day + func getYMD() -> (y: Int, m: Int, d: Int) + { + let calendar = Calendar.current + let comp = calendar.dateComponents([.year, .month, .day], from: self) + return (comp.year!, comp.month!, comp.day!) + } }