Convert A Number To Month Name and Month Name to Number in ASP.NET

For Converting A Number To Month Name Use:

dim MyMonthNumber as integer = 7
MonthName(MyMonthNumber)

or

Format(New Date(2009, MyMonthNumber, 1), "MMMMM")

-------------------------------------------------------------------------

For Converting A Number To Month Name Use:

dim MyMonthName as String = "July"
CDate("01-" & MyMonthName & "-2009").Month

2 comments:

  1. There is no such thing as a MONTHNAME() function in Oracle, sorry.

    ReplyDelete
    Replies
    1. it is in ASP.NET friend, for Oracle use to_char(sysdate,'MONTH')
      also check out http://nimishgarg.blogspot.in/2010/11/oracle-some-important-date-queries.html

      Delete