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 6748443
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T12:33:56+00:00 2026-05-26T12:33:56+00:00

Since the Date class in Java was deprecated, I had quite less frequently been

  • 0

Since the Date class in Java was deprecated, I had quite less frequently been using it but when I used it, felt that it might sometimes irritate someone as it displays the current year after subtracting 1900 from it. What should the designers have actually felt and imposed such a mechanism while the Calendar class and it’s subclass GregorianCalendar return the exact year that is being maintained by the system as follows?

public class Main
{
    public static void main(String[] args)
    {
        Date d=new Date();
        System.out.println("Day : "+d.getDate()+" Month : "+d.getMonth()
        +" Year :  "+d.getYear());

        Calendar c=Calendar.getInstance();
        System.out.println("Day : "+c.get(Calendar.DATE)+" Month :  
       "+c.get(Calendar.MONTH)+" Year : "+c.get(Calendar.YEAR));
    }
}

It displays the output something like the one shown below, the current day, month and year.

Day : 1 Month : 10 Year : 111

Day : 1 Month : 10 Year : 2011


What the designers might have though about displaying 111 rather than 2011?

  • 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-26T12:33:57+00:00Added an answer on May 26, 2026 at 12:33 pm

    The subtraction is just for the sort year field ‘y’. If you specify the long year field, ‘Y’ no subtraction occurs.

    If you mean, why does the default toString use the short year format, I assume it was the most natural expression the java devs came up with for the average situation. If you need to display a Date object with a different formatted date, consider using the SimpleDateFormatter class: http://download.oracle.com/javase/6/docs/api/java/text/SimpleDateFormat.html

    SimpleDateFormat formatter = new SimpleDateFormat("yyyy.MM.dd G 'at' HH:mm:ss z");
    formatter.format(new Date());
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need something simple like date , but in seconds since 1970 instead of
I have a Java class representing an event that contains some data, and also
I'm trying to create a simple date class, but I get an error on
I'm working on a Java project for class that stores workout information in a
I'm currently wrestling with an Oracle SQL DATE conversion problem using iBATIS from Java.
I am trying to subclass the immutable date class in Python, but I also
I had a simple CUDA problem for a class assignment, but the professor added
I'm using this mapper created by Ikai Lan: package com.ikai.mapperdemo.mappers; import java.util.Date; import java.util.logging.Logger;
Suppose I want to have a class like Java Date . Its only data
I a newbie to java and hence haven't been able figure this out since

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.