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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T09:36:01+00:00 2026-06-01T09:36:01+00:00

i am using an edittext for the user input in which user entered his

  • 0

i am using an edittext for the user input in which user entered his Date of birth. The input type of the edittext is Date and then i am passing that date to a variable. That date is not passed to that variable and giving some error.

The code i am using is below

Edit dob=(EditText)findViewById(R.id.dob);
    SimpleDateFormat sdf = new SimpleDateFormat( "yyyy/MM/dd" );
    String dob_var=sdf.format(dob.getText());
    //dob_var=dob.getText().toString();
    System.out.println(dob_var);

After that i want to pass that date in database so what is the type require to store that date in database.
My logcat is:

    04-05 16:54:22.060: D/AndroidRuntime(3104): Shutting down VM
04-05 16:54:22.146: E/AndroidRuntime(3104): FATAL EXCEPTION: main
04-05 16:54:22.146: E/AndroidRuntime(3104): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.foursquaregame.in/com.foursquaregame.in.Astro_talk}: java.lang.IllegalArgumentException
04-05 16:54:22.146: E/AndroidRuntime(3104):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2663)
04-05 16:54:22.146: E/AndroidRuntime(3104):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
04-05 16:54:22.146: E/AndroidRuntime(3104):     at android.app.ActivityThread.access$2300(ActivityThread.java:125)
04-05 16:54:22.146: E/AndroidRuntime(3104):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
04-05 16:54:22.146: E/AndroidRuntime(3104):     at android.os.Handler.dispatchMessage(Handler.java:99)
04-05 16:54:22.146: E/AndroidRuntime(3104):     at android.os.Looper.loop(Looper.java:123)
04-05 16:54:22.146: E/AndroidRuntime(3104):     at android.app.ActivityThread.main(ActivityThread.java:4627)
04-05 16:54:22.146: E/AndroidRuntime(3104):     at java.lang.reflect.Method.invokeNative(Native Method)
04-05 16:54:22.146: E/AndroidRuntime(3104):     at java.lang.reflect.Method.invoke(Method.java:521)
04-05 16:54:22.146: E/AndroidRuntime(3104):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
04-05 16:54:22.146: E/AndroidRuntime(3104):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
04-05 16:54:22.146: E/AndroidRuntime(3104):     at dalvik.system.NativeStart.main(Native Method)
04-05 16:54:22.146: E/AndroidRuntime(3104): Caused by: java.lang.IllegalArgumentException
04-05 16:54:22.146: E/AndroidRuntime(3104):     at java.text.DateFormat.format(DateFormat.java:373)
04-05 16:54:22.146: E/AndroidRuntime(3104):     at java.text.Format.format(Format.java:133)
04-05 16:54:22.146: E/AndroidRuntime(3104):     at com.foursquaregame.in.Astro_talk.onCreate(Astro_talk.java:32)
04-05 16:54:22.146: E/AndroidRuntime(3104):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
04-05 16:54:22.146: E/AndroidRuntime(3104):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
04-05 16:54:22.146: E/AndroidRuntime(3104):     ... 11 more
  • 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-01T09:36:02+00:00Added an answer on June 1, 2026 at 9:36 am

    Finally got it,

    DateFormat formatter = new SimpleDateFormat("dd/MM/yyyy"); // Make sure user insert date into edittext in this format.
    
    Date dateObject;
    
    try{
    String dob_var=(tx.getText().toString());
    
    dateObject = formatter.parse(dob_var);
    
    date = new SimpleDateFormat("dd/MM/yyyy").format(dateObject);
    time = new SimpleDateFormat("h:mmaa").format(dateObject);
    }
    
    catch (java.text.ParseException e) 
        {
        // TODO Auto-generated catch block
            e.printStackTrace();
            Log.i("E11111111111", e.toString());
        }
    
        Toast.makeText(getBaseContext(), date + time, Toast.LENGTH_LONG).show();
    

    Hope this will help you…

    Thanks…

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

Sidebar

Related Questions

What is the best way to store previously entered user input from an EditText
Using TortoiseSVN against VisualSVN I delete a source file that I should not have
Using my onEditTextchanger. It works fine when the user inputs 100000, in the EditText
I'm using an EditText in which the text is filled programaticaly, when users performs
I've developed a dialog box that prompts a user to enter his/her phone number
I want to get user input using a pop-up dialog box. I am able
I have an EditText using android:inputType=textPostalAddress as the keyboard type. I would like it
HI..I doing geocoding in android map.(i.e)getting address as input from user & locate that
im making an android application which requires a user to register using a form
I have 14 edittext boxes that a user can change at will. When the

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.