I need to process date in the format of “28/01/2022” into “31/01/2022”
i.e: Last date of the given date month.
Can any one please give suggestion fro this use case.
Thanks
Kiruthika
I need to process date in the format of “28/01/2022” into “31/01/2022”
i.e: Last date of the given date month.
Can any one please give suggestion fro this use case.
Thanks
Kiruthika
we can dynamicaly calculate the end month date by following:
YourDateTimeVar.AddDays(- YourDateTimeVar.Day + 1).AddMonths(1).AddDays(-1)
HI,
FYI, another approach:
yourString = "28/01/2022"
Then
System.Text.RegularExpressions.Regex.Replace(yourString,"(\d+)/(\d+)/(\d+)",Function(m) DateTime.DaysInMonth(CInt(m.Groups(3).Value),CInt(m.Groups(2).Value)).ToString()+"/"+m.Groups(2).Value+"/"+m.Groups(3).Value)
Regards,
@ppr Thanks its working fine
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.