Extracting date and month from date

Hi, I am trying to extract date and month from the current date. I have used string methods but i am getting below error. Can anyone help?

Output should be in the from : 28/02 (in this way)
I am getting the error : “LastIndexOf” is not declared, it may be inaccessible due to its protection level.

Hi @Sirisha_Siri

You can try with the below method!

dateString.Substring(0,5)

image

image

Regards

HI,

It should be as the following.

newdate.Substring(0,newdate.LastIndexOf("/"))

Regards,

1 Like

Hi @Sirisha_Siri

kindly use this expression

Datetime.ParseExact(MyDate, “dd/MM/yyyy”, System.Globalization.CultureInfo.InvariantCulture).ToString(“dd/MM”)

MyDate will be your input variable

Thankyou, how can i interchange month and date?
Ex : “Week of 02/28”

Thankyou, how can i interchange month and date?
Ex : “Week of 02/28”

Thankyou, how can i interchange month and date?
Ex : “Week of 02/28”

Convert.ToDateTime(“StringVariable”).ToString(“MM/dd”)

kindly use this @Sirisha_Siri

Hi @Sirisha_Siri

Try the below expression

CDate(InputString).Tostring(“MM/dd”)

Regards
Gokul

Thanks…This helped

1 Like

Happy Automation @Sirisha_Siri

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