hello12345678
hello12345678

Reputation: 17

change date formatting using java script from imported csv file

I have imported CSV file to google-sheet. I have date there which comes up as 11th of August 2019 however I want it to come up as 11/08/2019. The content of csv file is converted into array and displayed. I am not certain about the approach I can take. I don't want to edit the file. Is there way of doing it without having to edit the file.

I have tried getting the range from the sheet and formatting that way but it doesn't work.


  cells.setNumberFormat("dd-mm-yyyy");

Upvotes: 0

Views: 580

Answers (1)

Benedikt Böhm
Benedikt Böhm

Reputation: 351

Using the momentJs library you could just do it as

moment(cells, "Do of MMMM YYYY").format('DD/MM/YYYY')

Upvotes: 1

Related Questions