Countless times during the day I am copying and pasting records from SQL Server Management Studio to Excel.
My problem is that a DateTime
value such as
I've had this same problem for a while as I generate a fair number of ad-hoc reports from SQL Server and copy/paste them into Excel. I would also welcome a proper solution but my temporary workaround was to create a default macro in Excel which converts highlighted cells to Excel's datetime format, and assigned it to a hotkey (Shift-Ctrl-D in my case). So I open Excel, copy/paste from SSMS into a new Excel worksheet, highlight the column to convert and press Shift-Ctrl-D. Job done.
Found a solution that doesnt requires to remember and retype the custom datetime format yyyy-mm-dd hh:mm:ss.000
=NOW()
or any valid date+time like 5/30/2017 17:35
: It will display correctly in your language, e.g. 5/30/2017 5:35:00 PM
This will copy a proper datetime format to the whole column, making it display correctly.
I know it is too late to answer to this question. But, I thought it would still be nice to share how I sorted this out when I had the same issue. Here is what I did.