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

  • Home
  • SEARCH
  • 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 9116481
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T04:40:59+00:00 2026-06-17T04:40:59+00:00

In my app I have a date saved in a remote database that I

  • 0

In my app I have a date saved in a remote database that I want the date picker to be set to. I’ve researched and only found examples of setting the datepicker today’s date via Calender java util. Example:

final Calendar c = Calendar.getInstance();
        year = c.get(Calendar.YEAR);
        month = c.get(Calendar.MONTH);
        day = c.get(Calendar.DAY_OF_MONTH);

How can I use the Calendar to display my date from the database and not today’s date? Do you have any suggestions or examples I can follow?

Update:
After experimenting with Calendar I tried to use

     // set Date
            String eventYear =date.substring(0,4);
            String eventDay =date.substring(5,7);
            String eventMonth =date.substring(8,10);
        //convert string to int for because calendar only takes int: set(int,int)
        int month = Integer.parseInt(eventMonth);
  final Calendar c = Calendar.getInstance();
     mMonth=c.get(c.set(Calendar.MONTH, Calendar.month));
// or   mMonth=c.get(Calendar.MONTH, Calendar.month);

Generates error that says cannot convert int to void.

How can I use Calendar to set it to a specific date? According to google’s developers site I should be able to do this.
http://developer.android.com/reference/java/util/Calendar.html

example:

set(Calendar.MONTH, Calendar.SEPTEMBER)

I’d like the date to be display in the datepicker from the server as a default value.

  • 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-17T04:41:00+00:00Added an answer on June 17, 2026 at 4:41 am

    U can use the updateDate(year, month, day_of_month);
    date picker returns integer values of day, month and year. so the parameters must be integer values. and the integer value for the month jan in the date picker is 0.

    i needed to put the date extracted from a database into a datepicker. I wrote the following code and it works.

    DatePicker DOB;
    SQLiteDatabase db;
    
    DOB=(DatePicker)findViewById(R.id.datePicker1);
    
    db = openOrCreateDatabase("BdaySMS", SQLiteDatabase.CREATE_IF_NECESSARY, null);
    Cursor cur = db.rawQuery("select * from BdaySMS where ph='"+pn+"';", null);//pn is the phone no.
    
    if(cur.moveToFirst())
    {
        name.setText(cur.getString(0));
        phone.setText(cur.getString(1));
        DOB.updateDate(Integer.parseInt(cur.getString(4)),Integer.parseInt(cur.getString(3)),Integer.parseInt(cur.getString(2)));
        message.setText(cur.getString(5));
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have to create an app in which I must set a date and
In my app I used to have a time picker and a date picker.
I have a question. In my app I have saved in my database some
My app have a background image that fills the screen. I'd like to display
I'm using EasyTracker google analytics library and my app have multiple activities. I want
I have a rails app with a PostgreSQL database with hourly price data for
I have developed an app that allows the user to fill out text fields
I have an .xml file that is going to be shipped within my app.
I have a GAE app that uses the java.util.Calendar class. My app changes some
I have a Ruby on Rails app that has a scheduled job I execute

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.