bennovak
2 years agoNew Contributor III
Time Parsing Rule
I am trying to write a parser business rule to pull out the middle portion of a date string from a data source.
The file has the date as "1-Jan-23" and I want to pull out the Jan. On the data sour...
- 2 years ago
Here are a couple ways to do this depending on the requirement:
'returns period in Mn notation (e.g. M1, M2...) Dim month As Integer = DateTime.ParseExact(args.Value, "d-MMM-yy", CultureInfo.InvariantCulture).Month return $"M{month}" 'returns the Three letter month abbreviation (e.g. Jan, Feb...) Dim strMonth As String = DateTime.ParseExact(args.Value, "d-MMM-yy", CultureInfo.InvariantCulture).ToString("MMM") return strMonth