🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.language
Article #18889

Extracting month from a Date to compare

#18889
From: Carlos Javier Castro Pe�a
Date: Thu, 02 Apr 1998 00:00
28 lines
1341 bytes
I need to compare if the actual month equals a string. The method is:

protected boolean filter_records (String tokens[], boolean valid, int
log_day, int log_month, int log_time, int log_service, int log_hostname,
int log_message, String configured_PERIOD) {
    Date date = new Date();
    if (configured_PERIOD.equals("all")) {
      valid = true;
    }
      else if ( (configured_PERIOD.equals("month")) &&
(tokens[log_month].equals(date.getMonth().toString()) ))  {
      valid = true;
    }
      else if ( (configured_PERIOD.equals("today")) &&
(tokens[log_day].equals(date.getDay().toString())) )  {
      valid = true;
    }
  return(valid);
  }

I receive the following errors:

object type required, but int found (in the else if sentences)
Warning: deprecated APIs are used.


Where are the problems?
Technical Details
Message-ID: <3523D11C.30C72A5A@iname.com>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f74b3,5b6b0738b3e4b73e,start
X-Google-Attributes: gidf74b3,public
From: "Carlos Javier Castro Pe�a" <jcaspen@iname.com>
Subject: Extracting month from a Date to compare
Date: 1998/04/02
Message-ID: <3523D11C.30C72A5A@iname.com>
X-Deja-AN: 340249893
Content-Transfer-Encoding: 7bit
Content-Type: text/plain; charset=us-ascii
Organization: Univerity of Kansas
Mime-Version: 1.0
Newsgroups: borland.public.jbuilder.java.language