I will pass the input month and I want my output as the next month of input month
fine
here you go
If month input given is
String in_month = “JAN”
Datetime.ParseExact(in_month,“MMM”,System.Globalization.CultureInfo.InvariantCulture).AddMonths(1).ToString(“MMM”)
or if in_month = “JANUARY”
then
Datetime.ParseExact(in_month,“MMMM”,System.Globalization.CultureInfo.InvariantCulture).AddMonths(1).ToString(“MMMM”)
or if in_month = “02”
then
Datetime.ParseExact(in_month,“MM”,System.Globalization.CultureInfo.InvariantCulture).AddMonths(1).ToString(“MM”)
cheers @Sweety_Girl
Is it posssible to have a single syntax for all type of input?
Inputs like:
Jan, January
Yes…
Like we can use a validation with if condition like the input month is of length 3 or with length more than three
Like this
In_month.ToString.Length >3
If true it will go to then part where we can use the format for MMM or goes to ELSE part where we can use the format for MMMM
Cheers @Sweety_Girl
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.