Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
Developer
Posts: 16,992
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: date field

use a sysout to print the statement to console, and use sqlitemanager or something similar to execute it on the db.
----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
Super Contributor
Posts: 425
Registered: ‎01-02-2013
My Device: BOLD 9900
My Carrier: sdvsdvsd

Re: date field

i have found that  months for calendar are counting in different way. from 0 to 11(0 for jan and so on,..)

i got month value by System.out.println("=DATE=datecount=="+_dateCal.get(Calendar.MONTH));
now what i want is that the months are counted from 1 to 12 can anyone help me....

here is my code

DateTimePicker datePickerDate = DateTimePicker.createInstance( _dateCal, "d-MMMM-yyyy", null);
if(datePickerDate.doModal())
{
StringBuffer dateStrDate = new StringBuffer();
_dateCal = datePickerDate.getDateTime();
_dateFormat.format(_dateCal, dateStrDate, null);
_editFieldDate.setText(dateStrDate.toString());

//System.out.println("0"+_dateCal.get(Calendar.DATE)+"/0"+_dateCal.get(Calendar.MONTH)+"/"+_dateCal.get(Calendar.YEAR));
//datecount = "0"+_dateCal.get(Calendar.DATE)+"/0"+_dateCal.get(Calendar.MONTH)+"/"+_dateCal.get(Calendar.YEAR);
try {
System.out.println("=DATE=datecount=="+_dateCal.get(Calendar.MONTH));
} catch (Exception e) {
// TODO Auto-generated catch block
System.out.println("ere="+e.getMessage());
e.printStackTrace();
}

 

Developer
Posts: 19,636
Registered: ‎07-14-2008
My Device: Not Specified

Re: date field

In your previous published code, you have use SimpleDateFormat to format the date.  If you look at the documentation for SimpleDateFormat you will see that it has a number of ways of specifying months, one of which enforces 2 digits and one that does not.  That should help you.  So read the SimpleDateFormat documentation. 

 

Remember I suggested you keep your lines of code to a minimum and your descriptions should be as complete as possible.  In the code you supplied, how much is actually relevant to this question?

 

Have you resolved your problem with extracting values from your SQL table?

Developer
Posts: 16,992
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: date field

just as a sidenote:
use prepared statements from the beginning. makes it much easier later when somebody enters ')drop tables somewhere...
----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
Super Contributor
Posts: 425
Registered: ‎01-02-2013
My Device: BOLD 9900
My Carrier: sdvsdvsd

Re: date field

yes i have solved that problem

Super Contributor
Posts: 425
Registered: ‎01-02-2013
My Device: BOLD 9900
My Carrier: sdvsdvsd

Re: date field

i want to set minimum years to 2004,how can i used datepicker.setminimum(ca9900.pnglender)  to set years to 2004

Highlighted
Developer
Posts: 19,636
Registered: ‎07-14-2008
My Device: Not Specified

Re: date field

Read the documentation.