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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T09:35:40+00:00 2026-06-10T09:35:40+00:00

I have 1 problem regarding Date Picker in Android. I have 2 date pickers:

  • 0

I have 1 problem regarding Date Picker in Android.

I have 2 date pickers:

  1. For start date

  2. For end date.

In start date I want to set 1st date of current month. And in end date I want to set current date (i.e. today’s date). I have set it and even I get Transaction like that dates… starting from 1st date to the current date. And even I can see in console date as 1st as start date and 25 (i.e. today’s date) as the end date.

But In Date Picker I can see current date only in both. As start date and end date. That means I get output from 1st date to current date but in Date Picker I can see current date only in both Date Picker.

Please help me.

Thanks in Advance.

Code is:

Date sDate=new Date(dp_startdate.getYear()-1900,dp_startdate.getMonth(),1);     
Date eDate=new Date(dp_enddate.getYear()-1900,dp_enddate.getMonth(),dp_enddate.getDayOfMonth());        
System.out.println("Sdate:"+sDate.toString());
System.out.println("EDate:"+eDate.toString());

SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
String startDate=formatter.format(sDate);
String endDate=formatter.format(eDate);

System.out.println("start Date is:"+startDate);
System.out.println("end Date is:"+endDate);

Bundle bundle=new Bundle();

bundle.putString("startDate", startDate);
bundle.putString("endDate", endDate);

System.out.println("start Date is:"+startDate);
System.out.println("start Date is:"+endDate);

Please help me.

  • 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-10T09:35:41+00:00Added an answer on June 10, 2026 at 9:35 am

    Try this–>

        dp = (DatePicker) findViewById(R.id.datePicker);
        b = (Button) findViewById(R.id.button);
    
    
        b.setOnClickListener(new OnClickListener() {
    
            @Override
            public void onClick(View arg0) {
                // TODO Auto-generated method stub
    
                final Calendar c = Calendar.getInstance();
                int year = c.get(Calendar.YEAR);
                int month = c.get(Calendar.MONTH);
                int day = 1;
    
                dp.setVisibility(1);
    
                dp.init(year, month, day, null);
    
    
    
    
                StringBuilder s = new StringBuilder();
                s.append(month + 1).append("-").append(day).append("-")
                .append(year).append(" ");
    
                Toast.makeText(Datepicker.this, s, Toast.LENGTH_LONG).show();
    
    
            }
        });
    
    
    }
    
    
       <?xml version="1.0" encoding="utf-8"?>
       <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
       android:layout_width="match_parent"
       android:layout_height="match_parent"
        android:orientation="vertical" >
    
       <DatePicker
        android:id="@+id/datePicker"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" 
        android:visibility="invisible"
        />
    
        <Button
        android:id="@+id/button"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Button" />
    
    
    
        </LinearLayout>
    

    EDIT: Pasted xml as well

    Like u said u want one datepicker to be fixed to the current month’s first date,So instead of getting value of day from system’s calender(which will give u the current one, you can explicitly put whatever int value there.

    Then u can use this value i.e i have used the custom date value in toast..

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

Sidebar

Related Questions

Good day everyone! I have a problem regarding my date. It needs to be
I have a problem regarding Android App. I have created an application that download
I have problem regarding date in LINQ query which is binded to a gridview.
I have a problem regarding a query where i want to only display data
I have a problem that I want to add 15 days in my date
I have a problem regarding StartUp Url in WPF. I have a LoginView.xaml and
I have a problem regarding the datediff MYSQL function, I can use it and
I have a problem regarding the ksoap2. My problem is that the project used
Description: I have a problem regarding DataGridView . I need to show a Client_Name
I have the following code, and i have a problem regarding changing the ringtone

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.