+ Start a Discussion
Andrew TelfordAndrew Telford 

Method does not exist or incorrect signature: MONTH( DATE )

Hi have a class that I am using to return dynamic information to the visualforce page. The error is happening at 
 
IF( MONTH( Date.today() ) == 5 )

Full Code
PUBLIC STRING getButton()
    {
        IF( MONTH( Date.today() ) == 5 )
        {
            theButton = 'Show: ';
            RETURN theButton;
        }
        ELSE
        {
            theButton = 'dont show';
            RETURN theButton;
        }
        RETURN null;
    }



 
Best Answer chosen by Andrew Telford
Manish BhatiManish Bhati
Hi Andrew,
 
PUBLIC STRING getButton() {
   date mydate = Date.today(); 
   Integer month = mydate.month(); 
        IF( month == 5 ) { 
        theButton = 'Show: '; 
        RETURN theButton;
         } 
     ELSE { 
      theButton = 'dont show'; 
      RETURN theButton; 
      } 
       RETURN null; 
}

This will work.

Mark it as answer if it solves your problem.