Hi ucrhlyn,
Check this example. Now please take its reference and correct your code.
C#
protected void Page_Load(object sender, EventArgs e)
{
string startMonth = DateTime.Now.ToUniversalTime().ToString("MMM yyyy");
int newmnths = DateTime.ParseExact(startMonth, "MMM yyyy", System.Globalization.CultureInfo.CurrentCulture).Month;
int year = DateTime.ParseExact(startMonth, "MMM yyyy", System.Globalization.CultureInfo.CurrentCulture).Year;
ClientScript.RegisterClientScriptBlock(this.GetType(), "", "alert('Month : " + newmnths + "\\nYear : " + year + "')", true);
}
VB.Net
Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load
Dim startMonth As String = DateTime.Now.ToUniversalTime().ToString("MMM yyyy")
Dim newmnths As Integer = DateTime.ParseExact(startMonth, "MMM yyyy", System.Globalization.CultureInfo.CurrentCulture).Month
Dim year As Integer = DateTime.ParseExact(startMonth, "MMM yyyy", System.Globalization.CultureInfo.CurrentCulture).Year
ClientScript.RegisterClientScriptBlock(Me.GetType(), "", "alert('Month : " & newmnths & "\nYear : " & year & "')", True)
End Sub
Screenshot