Compiler error - NPOI.SS.Formula.Functions.Now

I was trying to get the start and end date for the previous month but however, encounter this error.

How do i rectify this issue. If not, is there any other way
i can go about doing this?

Hi,

For some reason, it seems ​Namespace completion does not work well.
Can you try the following?

New System.DateTime(DateTime.Now.Year,DateTime.Now.Month,1)

Regards,

1 Like

Alternatively you could get the first of this month, then use the .addmonth and .add days to get first and last of last month. -

Assigns
FirstofThisMonth=New System.DateTime(Now.Year,now.Month,1)
FirstofLastMonth=FirstofThisMonth.AddMonths(-1)
LastDayofLastMonth=FirstofThisMonth.AddDays(-1)

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.