Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7622795
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T04:32:36+00:00 2026-05-31T04:32:36+00:00

Android Programming The following code int year = new Time().year; is returning value of

  • 0

Android Programming

The following code int year = new Time().year;is returning value of year with default zone. So I am getting 1970 as the return value for year.

Whein I use the following constructor with field year String zone=new Time().timezone;
int year = new Time(zone).year;

I am getting the value for zone as ASIA/Calcutta but for year value I am still getting 1970 only. May I know why I am not getting the present year? Is there any other way to achieve the same?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T04:32:37+00:00Added an answer on May 31, 2026 at 4:32 am

    Check timezoneID is Asia/Calcutta.If you are Asia/Calcutta timezone But if you are not and want to set just set Like TimeZone est = TimeZone.getTimeZone( "Asia/Calcutta" );
    otherwise Use Below….

            Calendar cal = Calendar.getInstance();
            String timezoneID = TimeZone.getDefault().getID();
            cal.setTimeZone(TimeZone.getTimeZone(timezoneID));
            int year=cal.get(Calendar.YEAR);
            System.out.println(year);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm new to android programming and I'm having a little trouble with the following.
I am programming for Android 1.6, the following code works in 2.2 (API Level
I am new to XML, and Android programming.I was following a tutorial, which asked
Hi I'm relatively new to Android programming but I would be grateful of some
i am new to android programming. in my application if i press a backbutton
I'm new to Android programming. I've seen different phones with different screen resolutions that
Hi I'm new to android programming, I'm trying to initiate the on click method
I am very new to Android programming, and I have read everywhere and I
I'm new to android programming and i have a question I'm developing an alarm
i have just started android programming, wrote a quick code, and havn't managed to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.