How do I Change Date format from Regex Format

Ragex Format: System.Text.RegularExpressions.Regex.Match(strInvoiceDetails,“(?<=DocDt:)[\d\w/]+”).ToString

The format which I received : 27/06/2022

The format which I need : 27.06.2022


I think we don’t require regex here …

We can do like this…

Try this

Datetime.ParseExact(strInvoiceDetails.ToString, "dd/MM/yyyy", System.Globalization.CultureInfo.InvariantCulture).ToString("dd.MM.yyyy")

Assign this to DateTime variable


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