Hi team ,
My String value is “March 13,2024”
in these I need only these Output
“March 2024”
can you any one help me these issue
Hi team ,
My String value is “March 13,2024”
in these I need only these Output
“March 2024”
can you any one help me these issue
StrDate=DateTime.ParseExact("March 13,2024","MMMM dd,yyyy",System.Globalization.CultureInfo.InvariantCulture).ToString("MMMM yyyy")
or
System.Text.RegularExpressions.Regex.Match("March 13,2024","[A-Za-z]+").Value+" "+System.Text.RegularExpressions.Regex.Match("March 13,2024","\d{4}").Value
For this no need to use regex you can simply use the DateTime manipulations, Check the below one,
- Input = "March 13,2024"
- Output = DateTime.ParseExact(Input.toString, "MMMM dd,yyyy", System.Globalization.CultureInfo.InvariantCulture).toString("MMMM yyyy")
Or you can use the below regular expressions,
- Assign -> Input = "March 13,2024"
- Assign -> Output = String.Join(" ",System.Text.RegularExpressions.Regex.Match(Input.toString,"[A-Za-z]+(?=\s+\d+\,)|\d{4}"))
Check the below workflow for better understanding,
Hope it helps!!
Try this:
System.Text.RegularExpressions.Regex.Replace("March 13,2024", "\b\d{1,2},\b", "").Trim()
Hope it will helps you
Cheers!!