DateTime fields from SQL Server display incorrectly in Excel

后端 未结 9 611
独厮守ぢ
独厮守ぢ 2020-12-12 16:34

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

9条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-12 16:43

    I also had an issue with this problem simply copy and pasting DATETIME fields from SQL Management Studio to Excel for manipulation. Excel has the correct value of the DATETIME (even if the formatting is applied after the paste), but by default doesn't have a built in format to show the SQL DATETIME. Here's the fix:

    Right click the cell, and choose Format Cells. Choose Custom. In the Type: input field enter

    yyyy-mm-dd hh:mm:ss.000
    

    Reference: http://office.microsoft.com/en-us/excel-help/create-a-custom-number-format-HP010342372.aspx

提交回复
热议问题