Here are a few date formats that I’ve found useful over the years. These all come from getdate() and are changed by using COVERT or FORMAT commands. I’ve chosen a few of the date formats I’ve used the most:
- YYYY-MM-dd HH:mm
You can take the results from the commands and assign them to CHAR or VARCHAR variables. From there, you can use the variables to build larger strings for use in RAISERROR commands or BACKUP or regular display and export to Excel, etc.