65 We find our Lord in the Gospels knowing, yet not knowing, many things. Thus He does not know the workers of iniquity, who glory in their mighty works and in His name, for He says to them, Then will swear, I never knew you; depart from Me, all you that work iniquity. He declares with an oath even, that He does not know them, but nevertheless He knows them to be workers of iniquity. He does not know them, not because He does not know, but because by the iniquity of their deeds they are unworthy of His knowledge, and He even confirms His denial with the sanctity of an oath.
By the virtue of His nature He could not be ignorant, by the mystery of His will He refused to know. Again the Unbegotten God does not know the foolish virgins; He is ignorant of those who were too careless to have their oil ready, when He entered the chamber of His glorious coming. They come and implore, and so far from not knowing them, He cries, Verily, I say unto you, I know you not. Their coming and their prayer compel Him to recognize them, but His profession of ignorance refers to His will, not to His nature: they are unworthy to be known of Him to Whom nothing is unknown.
Hence, in order that we should not impute His ignorance to infirmity, He says immediately to the Apostles, Watch therefore, for you know not the day nor the hour. When He bids them watch, for they know not the day or the hour, He points out that He knew not the virgins, because through sleep and neglect they had no oil, and therefore were unworthy to enter into His chamber.
Source: On the Trinity (New Advent)