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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T13:50:31+00:00 2026-06-13T13:50:31+00:00

I have a simple form with a DatePicker component on it. The user can

  • 0

I have a simple form with a DatePicker component on it. The user can enter their date of birth and then submit the form. Once submitted they are shown a review of what they entered into the form. I have every other component on the form working apart from the DatePicker. I am successfully passing a value from the DatePicker into my Intent but for some reason I am getting a very strange, undesired date…

Does anyone know how I can retrieve the actual values the user put in? Below is a screen of what I am getting in the emulator.

Screenshot of Emulator

This is the part of my code in my onCreate method where I put the date info into the intent

Date myDate = new Date(date.getDayOfMonth(), date.getMonth(), date.getYear());
            i.putExtra("dob", myDate.toString());

And then in the activity to show the results this is the code where I display the information pulled from the intent.

dob.setText("Their date of birth is: " + extras.get("dob"));

As you can see I do successfully get output, it’s just not the date that I select on the DatePicker itself. I get no runtime errors at all. It’s a formatting thing I think. Not sure though so any feedback is appreciated!

  • 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-06-13T13:50:32+00:00Added an answer on June 13, 2026 at 1:50 pm

    I corrected the issue. Rather then creating a Date object and passing it into my intent I decided to retrieve the values from the DatePicker and storing them in integer variables.

                int day = date.getDayOfMonth();
                int month = date.getMonth();
                int year = date.getYear();
    
                i.putExtra("day", day);
                i.putExtra("month", month);
                i.putExtra("year", year);
    

    Following this I then retrieved the values from the Intent in the new Activity, formatted them and displayed them in a TextView.

        int day = extras.getInt("day");
        int month =extras.getInt("month");
        int year = extras.getInt("year");
        dob.setText("Their date of birth is: " + String.valueOf(day) + "/" + String.valueOf(month + 1) + "/" + String.valueOf(year));
    

    I had to add 1 to the month as for some reason If I chose January it would output 0.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a simple form on a page and I want to auto submit
I have simple form with a textarea and a button, and I submit the
I have a simple form, that when the submit button is pressed, it fires
I have a simple form, with two DateTimePicker-controls: One for date, and one for
I have a date field (i'm using the jquery ui datepicker) in a form
I have simple form. I want to use jquery to prevent form submit. $(document).ready(function()
I have a simple form on a view page, implemented as a user control,
I have a simple form, then I placed some data from the table to
i have a simple form to validate if an user exists in the db,
I have simple form. <form target=_blank action=somescript.php method=Post id=simpleForm> <input type=hidden name=url value=http://...> <input

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.