Calculate last day of month from string

Hello there,

I am trying to figure out how to handle this assignment, and hopefully someone can explain what to do :slight_smile:

Steps so far:

  1. Read text using Get text from website and store the data in var GetDateText
  2. Example of output from GetDateText: “Pending stuff at 12-12-2019” / “Pending stuff at 09-04-2019”

I want the output to be manipulated into “(12)-12-2019 → (31)-12-2019” / “09-04-2019 → 30-04-02019”

Essentially i want the output to be the LAST day in the month :slight_smile:

1 Like

Hi

What u can do is

Split the date based on “-”, assign that to variables like day , Month , year

then pass the month and Year in the below expression which will return you the last date of the month

Last day = system.DateTime.DaysInMonth(Year,Month)

example : system.DateTime.DaysInMonth(2019,02)

then frame the date using Last date + “-” + Month+“-” + Year.

Hope this Helps…!

4 Likes

Hi,

Thanks for the fast reply - and perfect solution. Just what i needed :wink: (Y)

1 Like

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