Date on two lines

Is it possible to insert a line break inside a user-defined custom format to show dates on two lines as follows?

Sunday
1 January 2019

I don’t think you can achieve this with a cell format.

Workaround formulas (use one of these):

=TEXT(TODAY();"DDDD")&CHAR(10)&TEXT(TODAY();"D MMMM YYYY")
=TEXT(TODAY();"DDDD"&CHAR(10)&"D MMMM YYYY")

In both formulas, replace TODAY() with a reference to the real date you are working with, as applicable. Note two occurrences of TODAY() in the first formula.

Note that all date calculation/sorting/filtering should be done on the aforementioned “real date”, which the workaround references. Thanks @anon73440385 for mentioning it (see comment).

Newline is inserted by control character number 10. CHAR(10) can be inserted into the format string for TEXT(), or into the final string expression, as in the formulas above. The “\n” escape sequence matches newline in some contexts, but not for cell format/styles. At least I haven’t found any way to do it yet.

Drawback: It is no longer a real calc date, but a text.

Yes, even code like that doesn’t help:

sub AddDateFormatWithNewline
    dim controller as object, oLocale as object
    controller = ThisComponent.CurrentController
    oLocale = controller.Selection.CharLocale

    dim nFmtId as Long, sFmtStr as String
    sFmtStr = "DDDD" & chr(10) & "D MMMM YYYY"
    nFmtId = ThisComponent.NumberFormats.queryKey(sFmtStr, oLocale, False)
    if nFmtId = -1 then
       nFmtId = ThisComponent.NumberFormats.addNew(sFmtStr, oLocale)
    end if

    controller.Selection.NumberFormat = nFmtId
end sub