Next month name

I will pass the input month and I want my output as the next month of input month

1 Like

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

1 Like

Is it posssible to have a single syntax for all type of input?

Inputs like:
Jan, January

You mean for date format
@Sweety_Girl

Yes…

1 Like

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

1 Like

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