The Artima Developer Community
Sponsored Link

Java Answers Forum
how do i get the year? ***example: 2003

1 reply on 1 page. Most recent reply: Jan 21, 2003 8:31 PM by jail

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 1 reply on 1 page
jail

Posts: 3
Nickname: jail
Registered: Jan, 2003

how do i get the year? ***example: 2003 Posted: Jan 21, 2003 8:06 PM
Reply to this message Reply
Advertisement
i have to get the currect year..
but i do not know which class to use... izzit the Date.class or Calendar.class or SimpleTimeFormat.class?

im confused by them. i did tried getting the year tru trial n error, but all i got is ***103..

this '103' is the output.. but wat i need is '2003'..
do anyone know how to get that?

plz reply, n thx a million!! ;)


jail

Posts: 3
Nickname: jail
Registered: Jan, 2003

Re: how do i get the year? ***example: 2003 Posted: Jan 21, 2003 8:31 PM
Reply to this message Reply
Well, i got the answer!!

**********************************

GregorianCalendar calendar = new GregorianCalendar();

System.out.println("YEAR: " + calendar.get(Calendar.YEAR));

**********************************
thatz it!!!

Flat View: This topic has 1 reply on 1 page
Topic: The Game of Clue (help) Previous Topic   Next Topic Topic: How to

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use