I trying to Extract Some text from the Date and Convert into Date Fomat dd.MM.yyyy - Exchange rate Notification No. 04/2024-Cus (NT) dated 18.01.2024-reg. [Effective from 19th January, 2024] "

I trying to Extract Some text from the Date and Convert into Date Fomat dd.MM.yyyy

String - Exchange rate Notification No. 04/2024-Cus (NT) dated 18.01.2024-reg. [Effective from 19th January, 2024] "

Want to Extract this - 19th January, 2024

output required format - dd.MM.yyyy

Please help me how i can dot that.

Hi @Ajinya_jorwekar

Hi @Ajinya_jorwekar

Please use the regex expression to extract the 19th January, 2024

assign:

output = System.Text.RegularExpressions.Regex.Match(StringVariable,"(\d+[a-z]+\s+[A-Za-z]+\,.*\d+)").Value.Replace("th","")

str_DateTime= DateTime.ParseExact(output,"dd MMMM, yyyy",System.Globalization.CultureInfo.InvariantCulture).ToString("dd.MM.yyyy")

Regards

@Ajinya_jorwekar

System.DateTime.ParseExact(System.Text.RegularExpressions.Regex.Match("Exchange rate Notification No. 04/2024-Cus (NT) dated 18.01.2024-reg. [Effective from 19th January, 2024]", "\b\d{1,2}(?:st|nd|rd|th)? \w+,\s\d{4}\b").Value, "d MMMM, yyyy", System.Globalization.CultureInfo.InvariantCulture).ToString("dd.MM.yyyy")

Hi,

Can you try the following sample?

CDate(System.Text.RegularExpressions.Regex.Replace(strData, "(?i)^[\s\S]+?\D(\d+)\D+(January|February|March|April|May|June|July|August|September|October|November|December)\D+(\d+)\D+$","$3 $2 $1")).ToString("dd.MM.yyyy")

Sample
Sample20240125-4.zip (2.6 KB)

Regards,

Really Thanks @Yoichi for your help.

I need one more help

I have a workflow

I want to compare this date with system date and if this date is equal to system date or +1 Day then only follow the workflow Else it will stop the Workflow

Hi,

Can you try as the following?

targetDate = CDate(System.Text.RegularExpressions.Regex.Replace(strData, "(?i)^[\s\S]+?\D(\d+)\D+(January|February|March|April|May|June|July|August|September|October|November|December)\D+(\d+)\D+$","$3 $2 $1"))

Then check it using the following condition

targetDate=DateTime.Today OrElse targetDate=DateTime.Today.AddDays(1)

Regards,

1 Like

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