The format method of the Date class is used to convert a Date to a String formatted in the current user's locale. This respects the locale settings of the user context under which the code is running, ensuring the date is represented in a way that is familiar to the user. References: Apex Developer Guide