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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T19:42:31+00:00 2026-05-23T19:42:31+00:00

I am using JDateChooser from here However I can not retrieve the date in

  • 0

I am using JDateChooser from here

However I can not retrieve the date in format set with the method setDateFormatString while displaying it in console.

enter image description here

In first label shows actual date retrieved from JDateChooser while second label shows the format which I have set. When I select date from JDateChooser I get the date as 22-07-2011 as shown in image. But when I use getDate method, it will give me date as Fri Jul 22 00:00:00 GMT+05:30 2011. I want only 22-07-2011.

Here is my code. I am using Netbeans IDE 7.0

public JDateChooser() {
    initComponents();
    dateChooser.setDateFormatString("dd-MM-yyyy");
}
private void btnDisplayDateActionPerformed(java.awt.event.ActionEvent evt) {
    String dateFromDateChooser = dateChooser.getDate().toString();
    lblDate.setText(dateFromDateChooser);
    lblDateFormat.setText(dateChooser.getDateFormatString().toString());
    System.out.println(dateFromDateChooser);
}
public static void main(String args[]) {
    java.awt.EventQueue.invokeLater(new Runnable() {

        @Override
        public void run() {
            new JDateChooser().setVisible(true);
        }
    });
}
  • 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-23T19:42:32+00:00Added an answer on May 23, 2026 at 7:42 pm

    You can use the String.format method to get the desired result.

    Date dateFromDateChooser = dateChooser.getDate();
    String dateString = String.format("%1$td-%1$tm-%1$tY", dateFromDateChooser);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Using php/html, I want to retrieve email addresses (plus other information) from MySQL and
Using PyGtk's IconView, I can set the icons to be reorderable by calling gtk.IconView.set_reorderable(True)
Using Yii, I want to delete all the rows that are not from today.
Using Java, how can I extract all the links from a given web page?
using this http://bl.ocks.org/950642 we can see how to add images to nodes, the question
Using Location.getBearing(); I seem to get randomly changing bearings. Aka, I can turn the
Using import datetime in python, is it possible to take a formatted time/date string
Problem: I'm using the selectableRange property of a DateChooser, but the DateChooser will not
Using jQuery, one can easily find out whether a particular element is visible using
Using mercurial, I've run into an odd problem where a line from one committer

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.