2
votes

I have a cell A2 with datetime like

30.11.2020 14:35:54

I need to convert it to MMMM YYYY like

November 2020

and then rename a sheet with this value

I tried MONTH function in another cell B2:

=MONTH(A2)&"."&YEAR(A2)

and it returns

11.2020

then I used value of B2 in script to rename current sheet

function onEdit(e) {
if(e.range.getA1Notation() !== 'B2') return;
    var s = e.source.getActiveSheet()
            s.setName(s.getRange('B2')
                .getValue())
}

Another try I did is TO_DATE function, and it looks fine in the cell, but sheet name looks like

Mon Nov 30 2020 14:35:54 GMT+0300 (East Africa Time)

but I don't know how to convert month number to month name

Any idea?

1

1 Answers

4
votes

try like this:

=TEXT(A2; "mmmm yyyy")