How to display last day of every year?

Hi All,

I need a help to display the last day of every year(in american format) i.e 12/31/2022 for the year 2022 , 12/31/2023 for the year 2023 , 12/31/2024 for the year 2024, 12/31/2025 for the year 2025 and so on.

Please do help me to find that.
@Palaniyappan
@ppr
@Yoichi
@Nithinkrishna
@nikhil.girish
@ushu
@rahulsharma
@geetishree.rao

Thanks in advance

Hi,

The last day of year is always 12/31. So the following will work.

Regards,

1 Like

Hi @HeartCatcher

try this

new DateTime(now.Year,12,31).AddYears(Your counter Variable)

counter keep on incrementing in for each

Thanks,

What is the datatype for that,because i need to write using the assign activity

for example you want next year

new DateTime(now.Year,12,31).AddYears(+1)

this year + 2

new DateTime(now.Year,12,31).AddYears(+2)

1 Like

Hi,

Please use string type.

strDate = "12/31/"+intYear.ToString

Regards,

1 Like

Thanks,

I need to write the code for only once because I am doing the project for current year 2022, next year it has to change to 2023,2024,2025 and so on

1 Like

ok sure have this in assign activity
@HeartCatcher

Str= new DateTime(now.Year,12,31).ToString(“MM/dd/yyyy”)

1 Like

so this when it runs in next years it will pick up the year accordingly @HeartCatcher

Thanks

1 Like

Thanks @nikhil.girish

1 Like

Thanks @Yoichi

1 Like

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