You can make a difference in the Apple Support Community!

When you sign up with your Apple Account, you can provide valuable feedback to other community members by upvoting helpful replies and User Tips.

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Date conversion in text-to-date format compatible with Numbers

Hello everyone,

I have a problem with Numbers. I should convert from a csv file the date format of the original file (e.g. 2020-03-02T17: 00: 00) into a format compatible with the software. How can I do? The file is quite large and it is difficult to do it by hand because it covers a period of a few months (there are 38,000 rows in the table) with numerous geographical variables. I attach a sample image of the table.

Posted on Nov 13, 2020 2:45 AM

Reply
Question marked as Top-ranking reply

Posted on Nov 13, 2020 5:12 AM

Assuming your computer is set so dates are written as as shown in the table (YYYY-MM-DD),


In a new column, use the formula =SUBSTITUTE(A, "T" , " ")+0

This will create a column of dates with the correct times. The "+0" at the end makes Numbers recognize it as a date vs text. Scan down the column to ensure no error triangles, which might happen if one of the "dates" in column A did not fit the pattern.

You may have to adjust the cell format to show the date and time the way you want to see it.


If you want those results to be in column A,

  1. Select the new column of dates
  2. Copy
  3. Paste Formula Results into column A
  4. Delete your new column, it is no longer needed
7 replies
Question marked as Top-ranking reply

Nov 13, 2020 5:12 AM in response to seneghe

Assuming your computer is set so dates are written as as shown in the table (YYYY-MM-DD),


In a new column, use the formula =SUBSTITUTE(A, "T" , " ")+0

This will create a column of dates with the correct times. The "+0" at the end makes Numbers recognize it as a date vs text. Scan down the column to ensure no error triangles, which might happen if one of the "dates" in column A did not fit the pattern.

You may have to adjust the cell format to show the date and time the way you want to see it.


If you want those results to be in column A,

  1. Select the new column of dates
  2. Copy
  3. Paste Formula Results into column A
  4. Delete your new column, it is no longer needed

Nov 13, 2020 5:03 AM in response to seneghe

Hi seneghe,


Assuming that each row in data (column A) has the same number of characters, you can insert extra columns and use the LEFT and MID functions to pull the data apart.


Formulas (and fill down):


B2 =LEFT(A2,4)

C2 =MID(A2,6,2)

D2 =MID(A2,9,2)

E2 =MID(A2,12,2)

F2 =MID(A2,15,2)

G2 =MID(A2,18,2)

H2 =DATE(B2,C2,D2)

I2 =TIME(E2,F2,G2)


You might want to Save as Template for future use.

Select and copy columns H and I then Menu > Edit > Paste Formula Results.

Then you can delete columns B to G.


Regards,

Ian.


Nov 15, 2020 6:37 AM in response to Yellowbox

Let's start from the point that I use the Italian version of Numbers, so the formulas are different.

B2 = LEFT (A2,4) works fine and extracts the first four digits of the date. While the formulas C2 = MID (A2,6,2) ... don't work. I guess the MID command is MEDIANA (?). Or maybe something else? Should the cells in Column A be in date, number or text format?

Date conversion in text-to-date format compatible with Numbers

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.