DateField problem

Hello I want to know how a DateField that does not display time that i.e. DateField should be like

October 21, 2010

the date should be display and it can be changed to user

I have not tried, but try this:

DateField dateField = new DateField (label, date, new SimpleDateFormat ("dd MMM YYYY"));

[EDIT]

To enable editing, you may need to add EDITABLE style flag:

DateField dateField = new DateField (label, date, new SimpleDateFormat ("dd MMM YYYY"), Field.EDITABLE);

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

  • 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);
    
  • DateFormat of DateField causing problem JDE 4.5

    I have a DateField, which uses the DateFormat class to display Date

    SimpleDateFormat myDtTm = new SimpleDateFormat ("YYYY/MM/dd hh: mm aa");

    DateField _dateField = new DateField ("Date:", System.currentTimeMillis (), myDtTm, DateField.DATE_TIME);

    Add (_dateField);

    DateField is added to the main screen

    Problem:

    As in hh hour is represented as 05 (i.e. two-digit)

    I tested the application for 4.5 and Simulator Date time does not appear as hh(i.e. 05 two digits), it is shown as 5 (i.e. h )

    Why does. I'm using _dateField.toString () and obtaining each field as day, month, year, minutes and seconds

    public Calendar convertStringToDate(String dateTime)
    {
    Calendar date = Calendar.getInstance();            date.set(Calendar.DATE,Integer.parseInt(dateTime.substring(0, 2)));
    date.set(Calendar.MONTH, Integer.parseInt(dateTime.substring(3,5))-1);
    date.set(Calendar.YEAR, Integer.parseInt(dateTime.substring(6,10)));
    date.set(Calendar.HOUR, Integer.parseInt(dateTime.substring(11,13)));
    date.set(Calendar.MINUTE, Integer.parseInt(dateTime.substring(14,16)));
    date.set(Calendar.SECOND, 0);
    date.set(Calendar.MILLISECOND, 0);
    
    String am_pm = dateTime.substring(17);
    
    //getIntAM_PM will return AM or PM
    
    int am_pmInt = getIntAM_PM(am_pm);
    date.set(Calendar.AM_PM,am_pmInt);
    return date;
    }
    

    Here, I get error because the time is only a number IE 5, during recovery, so 5: which is not analyze in Int

    Help, please...

    no need

    indexOf(':')

    will work fine.

  • Another problem with DateField in JDE 4.2.0! ??

    I have a custom date field object. It looks like this:

    [code]
    SerializableAttribute public class CustomDateField extends HorizontalFieldManager {}
    / the field bandwidth custom date * /.
    private int preferredWidth;
    / the field height custom date * /.
    private int preferredHeight;
    / * the date field * /.
    private DateField dateField;
    / * the checkbox field * /.
    private CheckboxField checkboxField;
     
    Private boolean readOnly;
     
    /**
    * Constructs a new custom date field.
    *
    @param date - long
    @param width - int
    @param height - int
    @param police - police
    @param LectureSeule - boolean
    */
    public CustomDateField (long date, int width, int height, are police, Boolean LectureSeule) {}
    Super (Manager.NO_HORIZONTAL_SCROLL);
       
    preferredWidth = width;
    preferredHeight = height;
    readOnly = LectureSeule;
       
    If (! readOnly) {}
    preferredWidth = 100;
    new CheckboxField = checkboxField ("", (date!) = Long.MIN_VALUE)) {}
    protected boolean trackwheelClick (int status, int time) {}
    If (getChecked()) {}
    dateField.setEditable (false);
    } else {}
    dateField.setEditable (true);
    }
    Returns false;
    }
    };
    checkboxField.setFont (do);
    }
       
    dateField = new DateField ("", 0, new SimpleDateFormat ("dd MMM yyyy"), DateField.DATE | ") DrawStyle.HCENTER) {}
    protected boolean trackwheelClick (int status, int time) {}
    If (isEditable()) {}
    If (GETDATE () == Long.MIN_VALUE) {}
    setDate (System.currentTimeMillis ());
    }
    Returns false;
    } else if (! readOnly) {}
    Dialog.Alert ('check the box to change the date!');
    }
    Returns true;
    }
    };
    dateField.setFont (do);
    dateField.setDate (date);
       
    If (readOnly |) (date == long.) MIN_VALUE)) {}
    dateField.setEditable (false);
    }
       
    If (checkboxField! = null) {}
    Add (checkboxField);
    }
    Add (dateField);
    }
     
    public int getPreferredWidth() {}
    preferredWidth return;
    }
     
    public int getPreferredHeight() {}
    return preferredHeight;
    }

    {} public long getDate()
    If (dateField.isEditable () | readOnly) {}
    Return dateField.getDate ();
    }
    Return Long.MIN_VALUE;
    }
     
    }
    [/ code]

    When I check the box, the date has become editable field, but I can just concentrate the subfield of day of the date field. So the only way to change the months or years is to increment the day. Do you have any suggestions? The problem would be the Director of horizontal field (I tried the FlowFieldManager also - without success)? Thank you!

    You have overridden navigationMovement anywhere?

  • External with DateField based ItemRenderer problem.

    Hello Experts

    I came across the 'problem' which I am not able to solve myself (I tried for the past 24 hours without success).

    I'm building a medium-sized application that will use the DataGrid components in many modules. These components will extend with ItemRenderes to enhance the user experience (and allow the manipulation of data).


    One of the DataGrids has a column with the date. This date field will be open user input.
    The easiest thing would be to build inline ItemRenderer of type DateField, something to this effect:

    < mx:DataGridColumn
    ID = "someDateFld".
    dataField = "someDateFld."
    headerText = "sort of date."
    itemRenderer = "mx.controls.DateField"
    rendererIsEditor = "true".
    editorDataField = "selectedDate" / >

    And this works perfectly well.

    However, I would like to be able to reuse ItemRenderers in my application and also send events (using the method of spread) that will trigger an additional feature is updated to another column with week number (read-only) based on the selected date. That's why I opted for external ItemRenderer.

    I created ItemRenderer with 2 components: HBox to align the date field (otherwise it would be aligned to the left of the data grid column which looks weird to say) and DateField. I have my DateField selectedDate property-related data. First of all, I had to convert my string RFC service return value to the type expected for selectedDate which is the Date object. Now when I run my application and start click/changing DataGrid rows, I get a nasty error message:

    ReferenceError: Error #1069: property selectedDate not found on ItemRenderers.DateFieldIR and there is no default value.
    at mx.controls::DataGrid/itemEditorItemEditEndHandler() [E:\dev\4.x\frameworks\projects\frame work\src\mx\controls\DataGrid.as:5297]
    at flash.events::EventDispatcher/dispatchEventFunction()
    at flash.events::EventDispatcher/dispatchEvent()
    at mx.core::UIComponent/dispatchEvent() [E:\dev\4.x\frameworks\projects\framework\src\mx\core \UIComponent.as:12528]
    at mx.controls::DataGrid/endEdit() [E:\dev\4.x\frameworks\projects\framework\src\mx\controls\ DataGrid.as:4514]
    at mx.controls::DataGrid/mouseDownHandler() [E:\dev\4.x\frameworks\projects\framework\src\mx\ controls\DataGrid.as:4790]

    This message has no sense to me at all. As mentioned above, I linked my value (converted to date object) date the selectedDate property on my ItemRenderer (called: ItemRenderers.DateFieldIR).

    Can someone please help me with this problem?

    Concerning
    Michael Orzechowski

    I'm not sure what you mean by "disconnect", but it is generally interesting

    practice to have "abstraction" and "encapsulation".  The model data for the

    rendering engine has two important values: the data property that corresponds to the entry of

    the collection element ArrayCollection and what you specified as

    the editorDataField, in this case, "selectedDate", which came out of the

    Editor and update the item in the collection ArrayCollection.

    The converter is an encapsulation or abstraction so your work when you customize

    is over these two values for the implementation correctly.

    When the rendering engine was just a DateField, he did all of this wiring to

    you, but now you buried inside a MXDGIR, so you need to proxy the

    information to and from this thing.

    There are several ways to code.  You can use two-way to data binding

    bind the selectedDate of the MXDGIR to the DateField selectedDate.  You could

    Implement the property selectedDate on MXDGIR like get that just works

    readers of the DateField.  Then you wouldn't need to mess with events, but

    in complex cases, you as events are sometimes necessary to warn others

    things in the renderer property values to be updated.

  • So many problem with DATEFIELD

    I have problem to install the correct method to use CFINPUT DATEFIELD. When I am on a normal mode (which means for me that I'm not in a CFWINDOW), I found that I have to put my value in this format:

    DATEFORMAT (var, ' dd/mm/yyyy "")

    But it does not work inside my CFWINDOW. The system indicates that the date or time is invalid. The same variable (I'm dealing with a variable that represents a start date) working in the home page as it doesn't work in the CFWINDOW. Why? This TAG is very useful, should in fact be more standard from any point of view!

    If someone has an idea to help me understand what I need to change to make it work, please let me know! I'm in the middle of a bad situation, I'm not able in the CFWINDOW to use a JavaScript calendar (it works on a normal page, but I can't import the entire script in a CFWINDOW. It is certainly possible to copy - paste everything in these script in JavaScript files directly into the CFWINDOW, but it too expensive for what it values when the CFINPUT DATEFIELD should also work).

    I include all of the code for my CFWINDOW in case someone wants to analyze what I could hurt!

    I finally change my interface completely! I decided to go with philosophy step by step, I had a lot of problem to play with a single page to receive all the information and forms. ste-by-step method, I decided to use is involving a CFLAYOUT which is the change from the simple link AHREF (where I use images instead of text to be more elegant for the user), click. This actually help me to complete this part of the application (after 2 intensive days of investigation of bugs about the new features in CF8). I don't say that the problem is CF8, in a contrary, but be careful when you use the new tags because some combinations can be a nightmare to find the right way - not to say - it's not possible to be used in combination at all for some of them.

    Maybe my imagination is too much the main use of these new tags in CF8 but style concept and dynamic programming is for me something that should be on the edge of the expectations of the user and we should have no limit to achieve a very high level of automated style to built a strong interface today! But I admit that this programming in this kind of philosophy involved a degree high record of each elements used - this is the most difficult part because it is not so easy to find the information shortly!

  • Problem with Flex DateField.

    Hello


    I'm trying to convert a date string Date using the DateField class object. My date string is "14 June 2009", and education.

    DT:date = DateField.stringToDate ("6 June 2009", "DD-MMM-YYYY");

    This property returns a null date.

    Whereas if I use the ' 14/06/2009' date string and form the string as "DD-MM-YYYY", it works fine.

    Any help will be appreciated.

    See you soon,.

    Rambeau.

    Try this one a little twisted function, Enjoy

  • 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);

  • Problem to get the background color

    Mr President, in my code, I wasn't able to use fully all the width of the screen,

    This is my code

    public class HorizontalField extends VerticalFieldManager
    {
       HorizontalFieldManager sd=new HorizontalFieldManager(HorizontalFieldManager.USE_ALL_WIDTH);
       HorizontalFieldManager r1=new HorizontalFieldManager(HorizontalFieldManager.USE_ALL_WIDTH);
       MySeparatorField ds=new MySeparatorField();
       Font fnt,fntv;
        HorizontalField()
        {
           fnt = this.getFont().derive(FontFamily.SCALABLE_FONT, 14);
           fntv = this.getFont().derive(FontFamily.SCALABLE_FONT, 11);
           r1.setFont(fntv);
           /*---------------------Heading-----------------------------------*/
           DateField dd=new DateField("Date");
    
           dd.setFont(fnt);
           sd.add(dd);
          /*------------------*/
           MyLine s=new MyLine();
           sd.add(s);
           Desp d1=new Desp("Description");
           d1.setFont(fnt);
           sd.add(d1);      
    
           /*_________________*/
           MyLine s1=new MyLine();
           sd.add(s1);
    
           Amt d2=new Amt("Amount");
           d2.setFont(fnt);
           sd.add(d2);
           add(new SeparatorField());
           add(sd);
           add(new SeparatorField());
    
               DateField dfr=new DateField("13.08.09")
               {
                   public void paint(Graphics g)
                   {
                        g.setBackgroundColor(Color.RED);
                        g.clear();
                        super.paint(g);
                   }
               };
               r1.add(dfr);
               MyLine sr=new MyLine();
               r1.add(sr);
               Desp dr=new Desp("Reent")
               {
                   public void paint(Graphics g)
                   {
                        g.setBackgroundColor(Color.RED);
                        g.clear();
                        super.paint(g);
                   }
               };
               r1.add(dr);
               MyLine sra=new MyLine();
               r1.add(sra);
               Amt amtr=new Amt("5000")
                 {
                   public void paint(Graphics g)
                   {
                        g.setBackgroundColor(Color.RED);
                        g.clear();
                        super.paint(g);
                   }
               };
               r1.add(amtr);
               add(r1);
               add(new SeparatorField());
    
           }
    
        }
    
     class DateField extends LabelField
    {
         DateField(String s)
        {
            super(s,LabelField.LEFT);
         }
        public  int getPreferredWidth()
        {
            return Display.getWidth()*2/10;
        }
    
    }
    
      class Desp extends LabelField
    {
         Desp(String s)
        {
            super(s,LabelField.RIGHT);
         }
        public  int getPreferredWidth()
        {
            return Display.getWidth()*5/10;
        }
    
    }
    
      class Amt extends LabelField
    {
        Amt(String s)
        {
            super(s,LabelField.RIGHT);
         }
        public  int getPreferredWidth()
        {
            return Display.getWidth()*4/10;
        }
    
    }
    

    MyLine code is

    public class MyLine extends LabelField
    {
        int width,height;
    
        ButtonField dd;
        MyLine()
        {
            width=1;
            //height=200;
        }
         MyLine(int w)
        {
            width=w;
            //height=200;
        }
    
         public int getPreferredWidth()
            {
                return width;
             }
    
         public void paint(Graphics g)
                {
                       // g.setBackgroundColor(Color.BLUE);
    
                     g.drawLine(0,0,0,70);
                }
    }
    

    When I call this HorizontalField I get the result, but in the amount column (i.e. red) background color I get half of this label, I don't know what problem I did

    Thank you

    The problem is in your calculation of width.

    Your should calculate your width in such a way that (approximate):

    Display.getWidth () = DateField width, width PED, Amt width + 2 * MyLine width;

    Furthermore, a solution may be simply change your constructor Amt class as below:

            Amt(String s)        {                   super(s,LabelField.RIGHT | Field.USE_ALL_WIDTH);        }
    

    Concerning

    Bika

  • Change of range counting DateField

    Hello

    Suppose I have a DateField with the format 'H m' i.e. it shows only the hours & minutes. In the case of the standard field, the time value gives a range of [0-23] & is between the value of the minutes [0-59]. Now, is it possible that I can count more than 23 in the subfield of time?

    For example, the DateField can contain a value of 2 days. I would like to be displayed as 48 hours 0 Min. Can anyone suggest a way to do this?

    Thank you.

    You can create your own cutom DateField.

    Press the button Bravo thank the user who has helped you.

    If your problem has been resolved then please mark the thread as "accepted Solution".

  • DateField question

    Hello

    I use the datefield with these two styles DateField.DATE_TIME | Most LEFT, but the problem is the update does not come to all areas of datefield, for ex:

    first component of the field date: February 21, 2011 06:53

    second part of field date: February 21, 2011 06:53

    If my focus on 21 of the first field, then he must go to the Feb, 2011, 6: 53, then to the second field of date, but in my case it will leave the first field in the second field

    I've been using the network manager and the problem was with gridmanager, he was the focus.

  • Problems with date calculation

    I have a java (and much more far vb) background and it seems that I'm really dependent functions for date calculations.  I'm trying to do a few things, but have not been able to accomplish them.

    I do not have

    Calendar.add()
    

    I briefly contemplated an add function by converting into long then do the calculation and returns a new calendar object, but the problems with this approach comes flourishes as soon as I started.  Just trying to find out if a date was yesterday was me banging my head against the wall.

    Any help please?

    I wrote this, but I don't know if there is a simpler method, go to this issue the wrong way, etc.

    public static boolean isYesterday(Calendar c) {
        Calendar today = Calendar.getInstance();
        int newDay = today.get(Calendar.DAY_OF_MONTH);
        if (newDay == 1) { //get last day of previous month
            int newMonth = today.get(Calendar.MONTH);
            int newYear = today.get(Calendar.YEAR);
            /* If jan 1, get dec of last year */
            if (newMonth == 0) { //Java Calendar.MONTH is zero-based
                newMonth = 11;
                newYear -= 1;
            today.set(Calendar.YEAR, newYear);
            }
            today.set(Calendar.MONTH, newMonth);
            newDay = DateTimeUtilities.getNumberOfDaysInMonth(newMonth, newYear);
        } else {
            newDay -= 1;
        }
        today.set(Calendar.DAY_OF_MONTH, newDay);
        return DateTimeUtilities.isSameDate(today.getTime().getTime(), c.getTime().getTime());
    }
    

    'convert to tz to the device.

    I recommend that stick you with using UTC for everything.  If you want to display to the user, then a DateField will convert the hour UTC to local time.  SImpleDateFormat.formatLocal will also print you long time UTC to local time.  So I recommend that you do not have to convert once at the local level.

    Remember that System.currentTimeMillis () is time not UTC/GMT.

    Of course, that's a good advice or not depends on your app.

    I'm not aware of any third-party code that helps, I reinvented wheels square to all my treatment to date.  But I never really looked at.

    About your code, assuming that c calendar uses the local time zone, so I think that the code works.

  • DateField not working not not in Coldfusion 11

    I installed just for CF11 on our servers QA and dev and make me a strange problem on one of them. On our QA server, instead of the control calendar showing upward when < cfinput type = "datefield" > is used, I get the text "date picker. I can't find anything about it on the help forums, so I was hoping that someone has met that I can't understand the question. What baffles me, is that it works very well on a single server with the same version of CF. thanks is advanced.

    Of course, just after I ask the question, I found the answer. The CFIDE virtual directory was never created for some reason any on my web server so I just had to add that in IIS and it works fine now.

  • Reset of the datefield

    I tried to use the following to reset the datefield, but when I do, the datechooser attached to the datefield stops working

    _root.txt_date. Text = ";

    where txt_date is a datefield

    While I still don't see where the DateField component has a text property, I don't have this problem using the instructions that you have specified until I fix the button code in 'release' instead of 'click '...

    on (release) {}

    _root.txt_date. Text = ";

    }

    However, in the event that you continue to have a problem, try instead to use the selectedDate property.

    on (release) {}
    txt_date. SelectedDate = undefined;
    }

Maybe you are looking for

  • I got iMovie but now his party and I have to pay

    Hello Apple! I am very disappointed with apple, and now I won't be using apple as the iPhone. I got my iMovie when I bought my macbook air 13.3 inches 2015ver. But now my I film disappeared and said I have to pay. Apple, I need all my files in my iMo

  • Cannot use my watch...

    last night, I bought a swr50 and so far I am not able to use it. It comes with 4.4, so it does not work with my z3 with the latest android and like pc companion doesn't work right now, is there another way to update? no case its my connection, I have

  • Problem with the desktop icons

    I have the problem with the desktop icons... they come from both sides... one above the task bar and on the other hand under the task bar too... I'm unable to remove those who are below the taskbar.

  • 2 files exactly of same name in the same folder.

    I have encoutered something strange in windows 7. I have 2 files with exactly the same name, and the files are also in the same folder. When you open one of them and saving them without warning are given this file already exists. Cup and last file to

  • the 459 ordinal not found on the dynamic link library urlmon.dll.

    I have windows 7 ultimate and I download call of duty 4 and I can't run that it because the 459 ordinal has not located in the dynamic link library urlmon.dll. Please help me