DateField

How to configure your datefield so that it would show am/pm field?

like 10:25?

Welcome to the BlackBerry forums.

SimpleDateFormat review, I think it will do what you want.  For example, try something like this:

SimpleDateFormat sdF = new SimpleDateFormat ("HH: mm aa");
DateField hourMin = new DateField ("Time", 0, homeless);

Tags: BlackBerry Developers

Similar Questions

  • Problem of time setting Date DateField

    Hello.  I know I posted simillar in the past but now encounter the problem with what I think is linked to time zone.

    When I use the following code to set the time and date in a DateField leave a string I get the inconsitent results...

    DateFormat df = new SimpleDateFormat ("YYYY/MM/dd HH: mm");
    java.util.Calendar d2 = java.util.Calendar.getInstance (TimeZone.getDefault ());
    String date = ' 11/11/2011-14:11.
    yy int = 0, mm = 0, SD = 0, h = 0, e = 0;
    mm = Integer.parseInt (date.substring (0, 2)) - 1; January = 0
    DD = Integer.parseInt (date.substring (3, 5));
    YY = Integer.parseInt (date.substring (6, 10));
    HR = Integer.parseInt (date.substring (11,13));
    MI = Integer.parseInt (date.substring (14.16));
    D2. Set (Calendar.YEAR, AA);
    D2. Set (Calendar.MONTH, mm);
    D2. Set (Calendar.DATE, dd);
    D2. Set (Calendar.HOUR, human resources);
    D2. Set (Calendar.MINUTE, mi);
    D2. Set (Calendar.SECOND, 00);
    D2. Set (Calendar.MILLISECOND, 00);
    D2.setTimeZone (TimeZone.GetDefault ());
    long t2 = d2.getTime () .getTime ();
    _dateField = new DateField ("", t2, df);
    Add (_dateField);

    So will string ' 11/11/2011-14:11 ' to the datefield causes the time spend at 2010-11-12 02:11.  I've set the default calendar time zone doe.  Not sure why this is now occurring.

    Ah my bad, given the first bit and skips the rest! It is possible that you are using the TIME instead of HOUR_OF_DAY

  • How to display a given date in a DateField?

    Hi Experts,

    I'm developing an app for BlackBerry in Java. I want to display a date I will give statically for example "October 4, 2008. I did, but while reading, it is displayed in January 1, 1970. How can I display a static date in a DateField?

    Thank you and best regards,

    Nithya

    Simple use.

    import java.util.Date;

    Net.rim.device.api.i18n import. *;

    String date = new SimpleDateFormat("dd/MM/yyyy_hh:mm").format (new Date (System.currentTimeMillis ()));
    Add (new RichTextField (date));

  • How to set the default to 00:00:00 time in DateField

    I want to use the DateField to display a duration by default 00:00:00, but I'm still at the time as 12:00. Why?

    Calendar calendar = Calendar.GetInstance ();
    Calendar.Set (Calendar.HOUR_OF_DAY, 0);
    Calendar.Set(Calendar.minute,0);
    Calendar.Set(Calendar.second,0);
    SimpleDateFormat sdF = new SimpleDateFormat("hh:mm:ss");
    dateTime = new DateField ("", calendar.getTime () .getTime (), homeless);

    Use:

    SimpleDateFormat sdF = new SimpleDateFormat("HH:mm:ss");

  • Allowing the datePicker on a DateField

    I develop with JDE 4.7 and I wanted to add a DateField to one of my screens. When looking at the API I came across this method called enableDatePicker which was added in version 4.7. It looked interesting so I wanted to try, but when I call the method, it throws a NullPointerException.

    DateField date = new DateField();  date.enableDatePicker(true);
    

    Maybe it was completely did not implemented yet. What exactly is the method supposed to do?

    Any help will be appreciated.

    I was able to reproduce this and it will be sent to our development team.  You can call this method after the DateField has aired on a screen and the NullPointerException is not thrown.

  • Get DateField selected date?

    I have my DateField has been fixed as follows:

    SimpleDateFormat dmy = new SimpleDateFormat("yyyy MM dd");
        DateField depart = new DateField(str_depart, System.currentTimeMillis(), dmy);
    

    It is shown:

    2011 05 04
    

    I want to get the selected date of this area and I use getDate(); method that returns type of Long (1304485459386).

    How can I do to convert it to a string and 2011-05-04 show?

    Thank you

    Kind regards.

    Thank you very much!!  girishthakr

  • DateField with a maximum limit of date

    Hello

    How to set a maximum limit of date in a datefield. That is, user will not be able to choose the date that exceeds the maximum limit.

    You have determined and as suggested earlier in this thread, DateField does not provide a maximum or minimum you have to apply this restriction externally, using a FieldChangeListener or another control mechanism.  So, I think you can mark this as resolved.

  • DateField, HorizontalFieldManager + ObjectChoiceField = error

    I am creating a page layout so that there a datefield and objectchoicefield in the horizontalfieldmanger even, and it throws me illegalarguementexception every time. Can someone help me? Here is the code example.

    HFM HorizontalFieldManager = new HorizontalFieldManager();
    HFM. Add (new DateField ("Some Text:", Date () .getTime (new),))
    DateFormat.getInstance (DateFormat.TIME_DEFAULT)));

    HFM. Add (new ObjectChoiceField ("", new String [] {"some", "text"}));
    Add (HFM);

    The problem here is that the DateField occupies the entire width.  The ObjectChoiceField then try to deal itself.  He seems to be referring to the treatment of layout of a RichTextField and pass the width that it must work, and the string to be converted (in this case, it is "a little").  RichTextField barfs with an Exception, because there is no way that 'some' can fit in the space provided (-1 pixel).

    To get this working, you have to find a way to limit bandwidth claiming the DateField.  I thought you'd be able to do by indicating the field to put his time left (style == DateField.FIELD_LEFT, but which did not work, so I went back to my usual substitutions and created what follows, that works.)

    You can take it from here?

    HFM HorizontalFieldManager = new HorizontalFieldManager();
    HFM. Add (new DateField ("Some Text:", System.currentTimeMillis (),))
    {DateFormat.getInstance (DateFormat.TIME_DEFAULT))}
    public int getPreferredWidth() {}
    Return to 150;
    }
    Protected Sub layout (int width, int height) {}
    Super.Layout (getPreferredWidth (), height);
    }
    });
    HFM. Add (new ObjectChoiceField ("", new String [] {"some", "text"}));
    Add (HFM);

  • How to set a date in a datefield?

    Hi, how to set a date ("24/02/2009") in datefield. the date ' 02/24/2009' is of type string and is in the format "dd-MM-YYYY" as same as datefield Date format. Thanks in advance.

    Is it analyze yourself and use the Calendar class to set the year, month etc you are ripping into the calendar object - then do a Calendar.getTime ().  Or use

    HttpDateParser

    If your data is one of the supported formats.  Sorry haven't checked myself.

    Don't know other ways in the J2ME code.

  • Default date in a DateField

    Hi all

    I'm doing a default DateField be something like this:-/-/-where the bars represent day/month/year.

    Does anyone know how to do this?

    Thank you

    No-No. It is possbile. Use Long.MIN_VALUE (or MAX_VALUEI don't recall).

    He hid the jewel!

    Thank you

    Eugen

  • retrieve date DateField

    HII, please how to recover when DateField?

    I just use toString (), and it works

  • How DateField getDate

    Here is my code:

    SimpleDateFormat dmy = new SimpleDateFormat("dd MMM yyyy");
    
    DateField d_depart = new DateField("Depart :", DateField.DATE, dmy) {
    
    protected void drawFocus(Graphics graphics, boolean on) {// TODO Auto-generated method stub        graphics.setColor(16036864);
    on = true;
        super.drawFocus(graphics, on);
        }
    };
    

    It shows the default on-screen as date:

    19 Jan 1970
    

    I want to set it up to display the date as the current day and when the field is selected, and you press a button, this field returns the date data

    to a string like: November 29, 2010

    You guys could tell me how to proceed?

    Thanks and greetings

    http://www.BlackBerry.com/developers/docs/6.0.0api/NET/rim/device/API/UI/component/DateField.html#GE...

    Returns a representation of the date long. Create a new instance of Date with her and let your simpledateformat parse this date to get a string representation.

  • Problem with DateField.FIELD_LEFT

    Hi, I have a problem. I work with the DATEFIELD type, and I want to bring the date to the left. I put the style in the DateField.FIELD_LEFT field, but by the time I got to the right, and I can't put it on the left, how do I fix? Thank you
    Sorry for my English.

    This is just a sample.

    DateField fromDate = new DateField("From Date: ", 0, new SimpleDateFormat(DateFormat.DATE_FULL), Field.FIELD_LEFT | DrawStyle.LEFT | Field.FOCUSABLE);
    fromDate.setDate(new Date());
    add(fromDate);
    
  • Customize DateField...

    Hello

    I need to put a DateField and a field of button on the same line.  But what I notieced is the DateField uses the entire width of the screen.  Is it possible to set the width of the DateField.

    Can someone give me an example to do this please?

    Appreciate your help.

    Thank you

    Vincent

    Hello

    Use the landscape Manager and override the sublayout method.

    HFM = new HorizontalFieldManager (HorizontalFieldManager.FIELD_LEFT)
    {
    protected void sublayout (int width, int height)
    {
    layoutChild (datefield, getPreferredWidth(), getPreferredHeight());
    layoutChild (button, getPreferredWidth(), getPreferredHeight());
                    
    setPositionChild (datefield, 0, 0);
    setPositionChild (button, 180, 0);
    super.setExtent (FieldSize.screenWidth, height);
    }
    };

  • Question when the LabelField or DateField layout() method override

    Hello

    I add a LabelField to a VerticalFieldManager.

    I want set a fixed width for LabelField, trying to override the method of layout as follows:

    LabelField label = new LabelField ("some textToShow") {}

    public void layout (int width, int height) {}

    super.setExtent (40, 50);

    }

    {} public void paintBackground (Graphics g)

    super.paintBackground (g);

    }

    };

    Result: Gets text LabelField disappear, I try to draw a rect with the width and height, it displays the Manager, but I'm not able to view the text that I'm passing with the LabelField, similar happened with DateField too.

    I don't want to create a completely custom field, I want to just set the width of my choice and height as what is already to have that is to say the default height.

    Please let me know how to do this, what I am doing wrong.

    Please, it is urgent and let me know your comments.

    Thank you

    Kind regards

    Aparna

    I solved.

    Thank you

    Aparna

Maybe you are looking for

  • digital camera via firewire is not recognized

    Hello community of Lenovo, I got a refurbished T400 (6474WHF) with XP Professional SP3, it works very well so far. It has a Firewire (IEEE 1394) interface in front of her. When I connect my digital camera through IEEE, the camera is not recognized in

  • I would remove "research-Gol" from my computer

    Hello I would remove "research-Gol" from my computer. I deleted from Add/Remove, always comes back as a default browser. I removed the ons add grace to tools - manage add ons. Always returned as a default browser. I am windows runing XP with SP3 and

  • Convert a laptop with windows xp home edition in Turkish in English?

    I bought a samsung np-nc10 netbook in Turkey while he's on vacation in September 09 to access my desktop and need to change the operating system in English, now that I'm back in the States.  It came with windows xp edition em ulcpc in Turkish family.

  • b119wn sleekbook 15 HP: want to go to the stock windows 8 by downgrading windows 10.

    I had windows 8 at first, after the upgrade to 8.1, I started to update windows 10. I did the upgrade. I didn't like windows 10, so I wanted to go back to windows 8.I was given two options (a) reset (b) return to 8.1 windows I chose option a and the

  • Issues of 64 bit Vista that need to be resolved

    I have a new Gateway SX2800 Intel (R) Core (TM) 2Quad CPU Q8200 @ 2.33 GHz 4.00 GB DDR3 ram, Intel (TM) GMA X 4500 integrated video processor, 640GO hard drive running Windows Vista (TM) Home Premium SP1. I have a Safetydrill (TM) Maxtor (TM) OneTouc