

My_cell = ThisComponent.Sheets(0).getCellbyPosition(1,7) Each can be used with a valid date as argument. Here are various ways of formatting a date. My_cell.String = DateAdd("m", 3, my_date)įormatting a date always necesary for various calculations, macro processings especially when you need to extract the day, month, year, Weekday etc. My_cell = ThisComponent.Sheets(0).getCellbyPosition(1,5) My_cell.String = DateAdd("d", 3, my_date) My_cell = ThisComponent.Sheets(0).getCellbyPosition(1,3) If you use “m”, it would increase the date as months. If you pass as “d” as in day, the date would be increased on day. This function takes first argument as which part of the date needs to be increased. To add 3 days to the above date, use below DateAdd() function. My_cell = ThisComponent.Sheets(0).getCellbyPosition(1,1) We will put this date in a LibreOffice Calc cell. This function helps to convert the text formatted date to a date format. Once declared, we will use DateValue function. Add days and months to a dateĭeclaring a date variable can be done using below code: Dim my_date As Date We will pick any date and process it in different ways. By default, it holds Jan 1 year 0001 midnight. In basic, Date is a datatype used to store date and time values. In this tutorial I will show how to do basic date processing in basic via LibreOffice CALC cells.
