How to return the number of a month in C# function

Posted by john on Stack Overflow See other posts from Stack Overflow or by john
Published on 2010-05-19T17:46:34Z Indexed on 2010/05/19 17:50 UTC
Read the original article Hit count: 148

Filed under:

I want to return the number of a month and i made a function but it always returns 0

this is my code:

public int getNrMonth(String s)
    {
        int nr=0;
        if (s.Equals("January"))
            nr = 1
        if (s.Equals("February"))
            nr = 2;
        return nr;


    }

Could someone tell me wath is wrong please? I'm beginner!

© Stack Overflow or respective owner

Related posts about c#