How to get the date from a file name?

Hi,
I have a file named StaffList_01.11.2022 how can I get the date from file name as datetime format?

Thanks.

Hi @makboga,
You can use below
System.Text.RegularExpressions.Regex.Match(String_Vriable.ToString,β€œ\d+\W\d+\W\d+”).ToString

1 Like

HI @makboga

Try this expression

System.Text.RegularExpressions.Regex.Match("Your String Var","(?<=\_)\S+").ToString

Or

Split("Your string","_")(1)

image

Regards
Sudharsan

Hi @makboga

You can use this expression. This expression will not select any alphabet and β€œ_” special character.
Date_str = System.Text.RegularExpressions.Regex.Match(β€œYour String Var”,β€œ[^A-z_]+”).ToString

HI @makboga

Try this expression

System.Text.RegularExpressions.Regex.Match("YourString","\d{2}.\d{2}.\d{4}").ToString.trim

image

Regards
Gokul