Setting the limit for DatePicker

Can someone tell me how to set the maximum and minimum date picker date... I tried the setMaximumDate()

and setMinimumDate() methods, but this isn't ristricting the day and the month of date picker. I want that the date picker

to display only 10 days from the date of the day. Means that if this 10 days have fallen between 2 months so that it

2 months has only to display in the Chooser. Please help me as indicated as possible.

Unfortunately, your code was simply too confusing for me to try to understand what you had done wrong.

As a general rule, I suggest that you try to simplify all of your code, especially when he's not working and looking for ways to do the same.  You should also look at the API provided to see if you are actually re - invent the wheel.

In addition, you must be aware that 4 days is not always identical (24 * 3600 * 1000) * 4 - on a change of the summer time, 4 days might be a longer or shorter time.

Also you should also beware of the overflow on integer variables.

In any case, the following code seems to work.

Sorry, formatting of the code does not work for me, so I just pasted the code in...

public void datepicker() {}

create the min and max dates
Calendar minDateCal = Calendar.GetInstance (); will be the current date/time
DateTimeUtilities.zeroCalendarTime (minDateCal); So don't have Date...
minDateCal.set (Calendar.HOUR_OF_DAY, 12); Set in the middle of the day so the change in DST does on us.
Calendar maxDateCal = DateTimePicker.cloneCalendar (minDateCal);
Set the Schedule 4 days before now.
Date of tempDate = maxDateCal.getTime ();
long currentDateLong = tempDate.getTime ();
long currentDateInFourDaysLong = currentDateLong + 4 * DateTimeUtilities.ONEDAY;
tempDate.setTime (currentDateInFourDaysLong);
maxDateCal.setTime (tempDate);
       
create Picker
Calendar cal = Calendar.GetInstance ();
DateTimePicker datePicker is DateTimePicker.createInstance (cal, DateFormat.DATE_DEFAULT, DateFormat.MINUTE_FIELD);.
datePicker.setMaximumDate (maxDateCal);
datePicker.setMinimumDate (minDateCal);

If (datePicker.doModal ()) {}
User not to cancel Picker - extract the selected Date...
CAL = datePicker.getDateTime ();
System.out.println ("" + cal.get (cal. Jour_du_mois) + "-" + (cal.get (cal. (MONTHS) + 1) + "-" + cal.get (cal. YEAR));
}

}

Tags: BlackBerry Developers

Similar Questions

  • Set the limit of integration

    Hi guys,.

    I'm new to labview. Currently I use Labview 8.5 to connect with Tektronix GST 2024 B osciliscope to calculate the power. First, I use the example of Labview code. I joined the power but I want only the first cycle between 0 and 0.1. Are there ways to set the limit of integration to labview?

    Thanks for your help!

    Salvation day.

    When you want to incorporate some of your waveform, you need to integrate just that part!

    Just get the interesting part of the wave...

  • 4012 [1211140]: exceeded the limit for connection cache - how can I solve this problem

    "" "QUOTE-2016-11-18 09:40:48.680000 UTC - 4012 [1211140]: exceeded the limit for connection cache: imap://[email protected]@imap/ writes" rel="nofollow">-mail.outlook.com:993/select>/Drafts 09:40:48.680000 2016-11-18 UTC - 4012 [1211140]: queues url: imap://[email protected]@imap/ writes "rel="nofollow">-mail.outlook.com:993/select>/Drafts 2016-11-18 09:40:48.680000 UTC - 4012 [1211140]: seen play queue url: imap://[email protected]@imap/ writes" rel="nofollow">-mail.outlook.com:993/select>/Drafts 2016-11-18 09:40:48.680000 UTC - 4012 [1211140] ': creating instance of Protocol to play queue url: imap://[email protected]@imap/ writes "rel="nofollow">-mail.outlook.com:993/select>/Drafts 09:40:48.680000 2016-11-18 UTC - 4012 [1211140]: proposed url = drafts folder for connection has to wait = FALSE can run = FALSE-EXTRACT

    Excerpt from log file showing the problem.

    Have been using a Hotmail account by using IMAP on Thunderbird for a long time without problem. Then BANG. 02:00 and it refuses to work. TB message is 'server xxxx offline. The server may be down or there may be a network problem. »

    Problem with google, a lot of people seems to have. Usually involves the connection cache limit. Located on logging - you can see the result above. Connection cache limit. Set it to 1. No help.

    Contact Microsoft technical support. They were absolutely * no need, just make the assumption that the error lies between the keyboard and the Chair. They had me remove the Treasury Board account and recreate it. Which it won't, as it bangs against the connection cache limit. They say Thunderbird problem and refuse to help more. Help, please.

    Issue can be closed.

  • WARNING: could not set the limit of asynch I/O

    Each night database generation of trace with WARNING below
    Anyone know what this means?

    WARNING: could not set the limit asynch I/O to 252 for SQL direct I/O. It is set to 200


    Oracle Version: 11.1.0.7
    AIX 5.3

    This is the bug number, you must place it in the bugs database.
    Search for metalink notes is easy (as well that I mentioned) and then click bug.

  • How to set the password for HARD drive?

    Hello

    Could someone help me please by setting the password for TOSHIBA STOR. E ART 3 (1 TB 2.5 ") HARD DRIVE?

    Hello

    I n t have this external HARD disk, but Toshiba pre-installed some additional software on this subject for the creation of HARD drive password?

  • How to set the clock for the hours, minutes, and seconds with Windows XP

    How to set the clock for the hours, minutes, and seconds with Windows XP

    I don't know of your question.  If you ask how to show the clock in the tray system with hours, minutes and seconds, then download & run "Tclock Light".  Windows will not natively display the seconds.

    TClock Light: <> http://homepage1.nifty.com/kazubon/tclocklight/index.html >

    HTH,
    JW

  • Password reset disk error - "year error occurred while the wizard attempted to set the password for this user account.

    Hello!

    -A bit of background: the desktop PC that I use is Windows Vista Ultimate Edition, with active user accounts total five. I have my own account, and I can access the computer through (or through account from my brother, because I know its password).--

    I had this problem recently came where the administrator password (that I know for a long time and never changed) no longer works. So, after some research, I created a reset password on a USB disk, that I found in my house. I managed to create the disc, but when I tried to put the new password, I got the message error "an error occurred while the wizard attempted to set the password for this user account', which I must say is not very clear. I found a few methods of force - reset the password for the account of the admin, as using a sort of Windows Vista DVD or go to Safe Mode to find the hidden administrator account... but I have no idea what this DVD is or where to find, and in Safe Mode, there is no account user administrator to be seen. I believe that my machine is corrupted, but I don't want to buy a new. I want just to reset a password...

    Any help is appreciated. If I was not specific enough, I can specify in comments.

    Thank you!

    Hello

    You must make a password reset disk before that there are problems with a password, not afterwards.

    ________________________________________________________________

    Read this for your problem:

    http://support.Microsoft.com/kb/940765

    If you are unable to connect to Windows 7 or Windows Vista, you can use the Windows Vista System Restore feature, or the Windows 7 system restore feature.

    You may be unable to connect to Windows Vista or Windows 7 in the following scenarios:

    • Scenario 1: You recently set a new password for the protected administrator account. However, you don't remember the password.
    • Scenario 2: You type the correct password. However, Windows Vista or Windows 7 does not accept the password because the system is damaged.
    • Scenario 3: You delete a protected administrator account. Now, you cannot connect to another administrator account.
    • Scenario 4: You change an administrator account protected with a standard user account. Now, you cannot connect to another administrator account.

    You can also borrow and use a Microsoft Vista DVD, which contains the files for the different editions of Vista (Home Basic, Home Premium, Business and Ultimate) must be installed. The product key on your computer / Laptop box determines what Edition is installed.

    Other manufacturers recovery DVDs are should not be used for this purpose.

    _____________________________________________________________

    Microsoft prohibits any help given in these Forums for you help bypass or "crack" passwords lost or forgotten.

    Here's information from Microsoft, explaining that the policy:

    http://answers.Microsoft.com/en-us/Windows/Forum/Windows_7-security/keeping-passwords-secure-Microsoft-policy-on/39f56ef0-5d68-41AD-9daa-6e6019c25d37

    See you soon.

  • Sleep Timer Pavillion DV 7 - How do you set the timer for a different time setting?

    Sleep Timer Pavillion DV 7 - How do you set the timer for a different time setting?

    Hello Pidcock,

    Welcome to the HP Forums, I hope you enjoy your experience! To help you get the most out of the Forums of HP, I would like to draw your attention to the Guide of the Forums HP first time here? Learn how to publish and more.

    I understand that you want to change on your computer sleep timer. I'll be happy to answer that question for you. Now you have not specified what operating system you are using, so I guess it's the same operating system provided with your computer (Windows 7). I will provide you the HP support document: Management of power (Windows 7 and Vista) Options, which will guide you in how to set the power of your laptop. Just in case you have upgraded to Windows 8 I am also including the HP Support document: Manage the power (Windows 8) Options. This document will guide you through the same steps in Windows 8.

    I hope that I have answered your question to your satisfaction. Thanks for posting this question on the Forums of HP. Have a great day!

  • I tried to reset my password computer laptop but the laptop telling me an error occurred while the wizard attempted to set the password for this user account how can I fix this pleas

    I tried to reset my password computer laptop but the laptop telling me an error occurred while the wizard attempted to set the password for this user account, how can I fix this means if someone knows how to fix teas pleas answer me quickly I have to work

    Logging in as an admin account, then reset the password for the account of the problem.

  • How to set the color for background ChoiceBox point to ChoiceBox with css?

    How to set the color for background ChoiceBox point to ChoiceBox with css?

    I need to change the backgound color list items.

    I tried with the following code, but it's not help to:

    {.context-menu .choice-box

    -fx-background-color: Red;

    }

    .choice-box .menu-item {}

    -fx-background-color: red;

    }

    In Java 8, either of your selectors should work.

    In Java 7 (JavaFX 2.2), you need of the following workaround:

    #choice-box-menu-item {
         -fx-background-color: red ;
    }
    
  • Can I buy 5 LightRoom and set the language for the Portuguese (Brazilian)?

    Can I buy 5 LightRoom and set the language for the Portuguese (Brazilian)?

    Yes, https://www.adobe.com/cfusion/tdrc/index.cfm?product=photoshop_lightroom

  • set the location for folders or separate files?

    I am new to Dreamweaver and I want to try it on an existing site (files on local disk (c :)) / xampp/htdocs).) Specifically, I want to try how DW can help me to publish on the web. I use Dreamweaver CS5.5.

    I can open these files through DW but DW can't identify the dynamically related files. Can I set a place for the root folder that contains all of the site, or I have to create a new folder of root DW and set the location for each file?

    Site > new Site > test server

  • How to set the color for a particular column in the table in advance?

    How can we set the color for a particular column in advance table based on a few feteched of vo in process request query parameter?

    Hello

    Reference http://oraclearea51.com/blog/dynamically-color-the-rows-in-an-oa-framework-advanced-table.html

    and prev thread. Can color us the lines in the column of a table

    It will be useful.

    Kind regards
    GYAN

  • What is the limit for the creation of a primary key?

    Hi friends I have an another question... .Please help me...


    What is the limit for the creation of a primary key?


    Thank you

    I think that its 32

    Yes from the doc

    Primary and unique keys because composites are limited to 32 columns, a composite foreign key is also limited to 32 columns.

    Published by: Karthick_Arp on January 13, 2010 22:04

  • "You have reached the limit for the reservations authorized by customer.

    I got this error, whatever i use different apple ID. and also another telephone number of her present on ireserve. But if I try to use another type of government identification. This works. I don't know why the apple system can keep to see my id personal Government reach the limit and it should be fine clear every day. I try to call hong kong apple support. but they said they don't have solution and any part can help with my problem. It is quite interesting that they suggested me to use the information for other people to do the ireserve. can anyone help?

    I'm really confused by your question

    You have reached too much supply of iPhone on iReserve and get an error when you try to use a different number of phone or Apple ID, telling you that you have booked too much. So you try to book using a most other Hong Kong Government issued IDS, and it works

    I'm confused on what you need help with

Maybe you are looking for

  • Using a Skype number for working

    HelloI live in Italy and I work for a Dutch company. I'll have to call a large number of Dutch customers and they should be able to remember. It's very expensive to call with my phone to other countries, so I was thinking of using Skype for this. Of

  • Spare battery

    Hello Is the battery of laptop HP MU06 long life (HP part Code: WD548AA) HP G62 - 361TX NB PC-compatible. Please help. Thank you

  • microscada service not started

    I installed a program that runs on microscada service but the service does not start every time that I run the program, they have all admin previledges

  • My font too small in the text box, all screens, all is several small

    I find it difficult to read the text in the text box in Web page IE and firefox as well as any other window I open in my computer. I couldn't find the solution for this problem on the internet, including using microsoft and forums. Please don't sugge

  • Blue Screen BCCode: 10 d, is could someone help me solve the blue screen issue?

    HelloIs that someone could help me to solve the problem of blue screen. Thank youBCCode: 10 dBCP1: 0000000000000008BCP2: 0000057FE24DC4D8BCP3: 0000000000000004BCP4: FFFFFA801BA97A90OS version: 6_1_7601Service Pack: 1_0Product: 256_1