Article View: borland.public.jbuilder.java.api
Article #803Re: getting a current year
From: Gillmer J. Derge [TeamB]
Date: Fri, 01 Nov 2002 16:43
Date: Fri, 01 Nov 2002 16:43
17 lines
1573 bytes
1573 bytes
"News" <silva@carlosilva.com> wrote in message
news:3dc29cfa@newsgroups.borland.com...
> Please, I need current year. If I use Date.getYear(), JBuilder write '
> getYear is deprecated. Seek for better solution' .
Well, did you seek for a better solution? The API documentation for the
getYear method tells you what to use as an alternative: "As of JDK version
1.1, replaced by Calendar.get(Calendar.YEAR) - 1900."
Something like this (untested) should work.
Calendar calendar = Calendar.getInstance();
calendar.setTime(new Date());
int year = Calendar.get(Calendar.YEAR) - 1900;
--
Gillmer J. Derge [TeamB]
Technical Details
Message-ID:
<3dc2af47$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-03!sn-xit-06!sn-xit-08!supernews.com!news-out.visi.com!hermes.visi.com!newsfeed.wirehub.nl!PeerFeed.KWeb.on.ca!newsgroups.borland.com!not-for-mailReferences:
<3dc29cfa@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 1089d0,a30efa45031f7f8f X-Google-Attributes: gid1089d0,public X-Google-ArrivalTime: 2002-11-01 12:08:09 PST From: "Gillmer J. Derge [TeamB]" <spam@gillmerderge.com> Newsgroups: borland.public.jbuilder.java.api References: <3dc29cfa@newsgroups.borland.com> Subject: Re: getting a current year Date: Fri, 1 Nov 2002 11:43:52 -0500 Lines: 19 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1106 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106 NNTP-Posting-Host: 24.194.39.154 Message-ID: <3dc2af47$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1036169031 24.194.39.154 (1 Nov 2002 08:43:51 -0800) Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-03!sn-xit-06!sn-xit-08!supernews.com!news-out.visi.com!hermes.visi.com!newsfeed.wirehub.nl!PeerFeed.KWeb.on.ca!newsgroups.borland.com!not-for-mail