What is the Excel Date Format to retain dates in this specific format?

I am exporting the output of a SQL query into Excel 365 and one of the columns contain date values.

My SQl query output displays those values as 2014-05-08 12:14:50.000. I want to format this specific column in Excel so that it displays the values in its original format.

How can I do this in Excel?

2 answers

  • answered 2019-04-21 08:02 teylyn

    Depending on how you bring the SQL data into Excel, it may automatically be converted to an Excel date/time value. Or you can specify on data import that the column should be converted to date/time.

    If the date arrives as a text string, you can use the DateValue() function to convert the text string into an Excel date/time value.

    The format is just presentation of the date/time value. Select from any of the standard formats or roll your own. Without knowing the original format, it is hard to suggest what custom format you need.

    Mynda Treacy has a very good walk through here: https://www.myonlinetraininghub.com/excel-date-and-time-formatting

  • answered 2019-04-21 08:15 Jerry

    You can select the column you need to format, use format cells (you can use the shortcut Ctrl+1) and using custom formatting, use the following:

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

    And that should work:

    enter image description here