Knowing all this, you may resort to the distinction between numbers and text and how numbers are formatted in order to display dates, times, timestamps, currencies etc.
The following snippet has been recorded by MRI:
Sub Snippet(Optional oInitialTarget As Object)
Dim nNumberFormat As Long
Dim oSpreadsheet As Variant
Dim oDrawPage As Variant
Dim oForms As Variant
Dim oParent As Variant
Dim sImplementationName As String
Dim oNumberFormats As Variant
Dim oObj1 As Variant
Dim nType As Integer
nNumberFormat = oInitialTarget.NumberFormat 'returns 49
oSpreadsheet = oInitialTarget.getSpreadsheet()
oDrawPage = oSpreadsheet.getDrawPage()
oForms = oDrawPage.getForms()
oParent = oForms.getParent()
sImplementationName = oParent.getImplementationName()
oNumberFormats = oParent.getNumberFormats()
oObj1 = oNumberFormats.getByKey(49) 'the 49 from above
nType = oObj1.Type
REM returns 2
REM https://api.libreoffice.org/docs/idl/ref/namespacecom_1_1sun_1_1star_1_1util_1_1NumberFormat.html
End Sub
I queried the number format code of a cell, which was 49, navigated from there to the cell’s document and queried the number format 49 from the document’s NumberFormats. The number format has property Type, which is 2.
https://api.libreoffice.org/docs/idl/ref/servicecom_1_1sun_1_1star_1_1util_1_1NumberFormatProperties.html
According to LibreOffice: com::sun::star::util::NumberFormat Constant Group Reference, 2 means DATE.
No matter which numeric value (or which formula returning a number) I enter into this cell, the cell value will always be a floating point number displayed in some date format.
0.0 → 1899-12-30
40000.0 → 2009-07-06
=TODAY() → 2025-07-14
From above MRI recording, one may derive a function like this:
Function getNumberFormatType(doc, cell)
nKey = cell.NumberFormat
objFormat = doc.NumberFormats.getByKey(nKey)
getNumberFormatType = objFormat.Type
End Function
might work with Writer tables as well.