BASIC+Calc | How to separate day, month and year from the result of date calculation

From the code

oCell = ThisComponent.CurrentController.ActiveSheet.GetCellByPosition(0, 1)
.
.
oCell.Value = DateSerial(2019, 10, 25)
oCell = ThisComponent.CurrentController.ActiveSheet.GetCellByPosition(0, 2)
oCell.Formula = "=A2+45"

image description

How can I get day, month and year from cell A2 separately in Integer or String ?

Hello,

DD: =DAY(A2) and DAY(A3)
MM: =MONTH(A2) and MONTH(A3)
YYYY: =YEAR(A2) and YEAR(A3)

Hope that helps.

Dear @anon73440385 ,

From Cell A3, cell with formula, I’d like to get day, month and year directly from it in order to insert into database.

What’s the shortcut way without laying them into cells?

What do you mean by directly? How do you insert data into db? Copy/paste? Using some code?