Convert MMMM to MM

I have query as below.

Date_month = DateTime.ParseExact(date_1,“dd/MM/yyyy”,System.Globalization.CultureInfo.InvariantCulture).AddDays(-1).ToString(“MMMM”,culture)

Output = เมษายน ( local name month in TH language)

If I want variable for year (2564) and month (04).

Please guide me about it.

Hi, I’m not sure if I understood your question.

You can get year and month by passing the corresponding wildcard on ToString method.

.ToString("MMMM yyyy") # results in เมษายน 2564
.ToString("yyyy - MMMM") # results in 2564 - เมษายน
.ToString("MM/yyyy") # results in 04/2564

etc.

@ppr @alexandretperez
I want edit from .xaml as below.

Main.xaml (13.2 KB)

Please guide me about it.