Swift - Date from components is incorrect when printed. Date has 2 values?
问题 I'm trying to store a time of day in a Date: let calendar = NSCalendar.init(identifier: .gregorian) let components = NSDateComponents() components.hour = 7 components.minute = 0 var newDate = calendar?.date(from: components as DateComponents)! print(newDate!) However, this yields some bizarre results when I try to print or otherwise use the value. Here's a Swift Playground of the results: How can newDate be both 7:00AM and 11:56AM at the same time? 回答1: You didn't specify a time zone (by