Ask Your Question
1

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

asked 2019-11-13 12:31:51 +0100

lonk gravatar image

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 ?

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
1

answered 2019-11-13 13:18:41 +0100

Opaque gravatar image

Hello,

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

Hope that helps.

edit flag offensive delete link more

Comments

Dear @Opaque ,

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?

lonk gravatar imagelonk ( 2019-11-13 18:11:55 +0100 )edit

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

SM_Riga gravatar imageSM_Riga ( 2019-11-16 09:59:32 +0100 )edit
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2019-11-13 12:31:51 +0100

Seen: 26 times

Last updated: Nov 13