Extract only Month and Date from string

Hi Team,

How to extract only Month and date from below string

Nov 15 09:07 ms_acl_info

Oct 29 00:31 reginfo

Oct 29 00:32 secinfo

HI @Sathish_Kumar_S

Checkout this expression

System.Text.RegularExpressions.Regex.Match("Your String","^[a-zA-Z]+\s\d+").Tostring

image

Regards
Sudharsan

String.Join(" “,“Nov 15 09:07 ms_acl_info”.Split({” "},3,StringSplitOptions.None).Take(2))
“Nov 15”

Hello @Sathish_Kumar_S
Try the below regex expression

System.Text.RegularExpressions.Regex.Match("Your String",".*(?=\d\d:\d\d)").Tostring.Trim

image

Hi Satish Kumar

Can you share in which format do you need the Month and date i.e. dd/MM/yyyy?

Hi @Sathish_Kumar_S
To Get the output in dd/MM/yyyy. Kindly use the given expression in assign activity against a string type of variable-

Str_date = DateTime.ParseExact(“Nov 15 09:07”,“MMM dd HH:mm”, System.Globalization.CultureInfo.InvariantCulture).ToString(“dd/MM/yyyy”)