How to get Current year and Previous month

Hi,
I need to get the current year and previous month in the current year
Ex:- today is 2020-Feb-20
I need get 2020-Jan-20

Any suggestion

Date.Now.Tostring(“yyyy”)+“-”+Date.Now.AddMonth(-1).Tostring(“MMM-yy”)

4 Likes

Hi

Example:- Today is 16-Jan-2022
I need to get 16-Dec-2021

Can anyone help me out with this.

Hi @Sai_chnadrika_Kopparapu

kindly try below expression

Date.Parse("16-Jan-2022").AddMonths(-1).ToString("dd-MMM-yyyy")

Yourdatevar.addmonths(-1)

Hi,

I have a data table with one column of dd-mm-yyyy. now i need to filter the data for last month and sum the values of other column and then need to filter data for last three months and sum the values of other column and like wise for last 6 months and last 12 months. How can i do this?

Could any one please help me on this