=TEXT(3/25/2022,"mmmm") returns December instead of March?

I am trying to automatically display the full name of the current month (no date or year - just the month) in my header. I had trouble with that, so I figured a simpler step would be to try displaying the full name of the current month in a cell first.

I used the Insert>Date workflow to insert today’s date in cell F1. I then edit that cell to surround that date with the =TEXT() function, so my formula appears like =TEXT(3/25/2022,"mmmm"). However, that formula incorrectly evaluates to December instead of March. Why is this happening? Is this my mistake or should I report this as a bug?

-Thanks in advance, Ben

P.S. I have already double-checked my language and formats are all set to “Default - English (USA)” and “M/D/Y;M/D”.

A hint: 3 divide by 25 divide by 2022 is 5.93471810089020771513353115727e-5

“3/25/2022” (note the quotes) would be closer (and “2022-03-25” would be better).

DATE(2022;3;25) is explicit version.

3 Likes

It is an odd way to attempt to format a cell. Simply formatting F1 as Date with code MMMM will give you March anyway.

TEXT Function: Converts a value into text according to a given format.

You haven’t given it a value, you have given it text. If you had entered 44646 then it would return the month of March

If you enter in cell F2 the formula =TEXT(F1;"MMMM") then it will give the correct month because cell F1 has converted the text to a value already

3 Likes

The real date-time values are specially formatted numbers in the Calc application. The integer part of the number represents the elapsed days in a date relative to the base date. And the decimal fraction part represents the time value as a part of a day.
The integer part of the result number 5.93471810089020771513353115727e-5 is 0. The default base date is 1899 december 30. in the Calc application. In other words:
5.93471810089020771513353115727e-5 equals 1899-12-30 00:00:05

Therefore the “december” is the right result of YOUR formula.

3 Likes

My end goal is to use this formula in the header because there is basically no value formatting available in the page setup context menu where you can edit the contents of the header. Sorry for the frustration, but I tried stating my end goal at the beginning of my original question.