You can use the DateFormatter class to format the current date in the desired format. Here's the code snippet:
main.swift188 chars5 linesIn this code snippet, we create a new instance of DateFormatter and set its dateFormat property to "E d, yyyy", which specifies that we want the date to be formatted as "day-of-the-week day, year" (e.g., "Wed 23, 2023").
We then call the string(from:) method of the DateFormatter instance and pass in the current date (Date()), which returns a string representation of the current date in the specified format. Finally, we print the formatted date string to the console.
gistlibby LogSnag