function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ 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.