2021年4月6日星期二

How to correctly import m.d format date from flat file in SQL or Excel without being recognized as float?

I'm trying to import a flat file into excel or SQL (either one would work).

The file contains a column of date formated as m.d, such as 4.6 for April 6th and 3.30 for March 30th. When I import the file, the column is automatically formatted as float, so I lose the trailing 0 for the 10th, 20th and 30th in every month. As you can see, what supposed to be 3.30 becomes 3.3

Currently, I'm importing the data into Excel by power query. I change the data type to "Using locale" to show the trailing 0, split the column into 2 by period (so 3.30 becomes 3 and 30), and then assemble the two columns back to one correctly formatted date column.

I wonder if there is a smarter and quicker way to do this.

https://stackoverflow.com/questions/66978051/how-to-correctly-import-m-d-format-date-from-flat-file-in-sql-or-excel-without-b April 07, 2021 at 08:15AM

没有评论:

发表评论