How to fetch a saved date from CoreData

in my code line 6 is returning the save date but

line 7 is printing the current date

I want the save date instead for attribute "date" (line 6)


func getFormattedDate(date: Date, format: String) -> String {
                let dateformat = DateFormatter()
                dateformat.dateFormat = format
                return dateformat.string(from: date)
        }
_ = item.value(forKey: "date") as? NSDate
let formatingDate = getFormattedDate(date: Date(), format: "dd-MMM-yyyy")