Mask for date

Hi,
I would like to use a jTextField for a date input. I would like the user to input it in a spesific format. I know there is something like a mask, but not very sure. Can somebody please help me.
Thanks Linette

Thank u for your MaskField classes... Very useful.
But I found a bug in MaskDocument class
In insertString method : in the for loop change the call insertString(pos...) with insertString(i...) otherwise the first element is always replaced...(see below)
if (len > 1)
for (int i = pos; i < len; i++)
insertString(i, "" + text.charAt(i), attr);
return;
I have a question : how can you specify a mask with a variable length (e.g. years in the format YYYY or YY for the same mask?)
Many thanks
-- Nuts

Similar Messages

  • Can you specify format mask for date or timestamp columns

    Hi,
    Recently when I'm developing a PL/SQL application, I find that any format mismatch between data in table and format mask specified in to_date/to_timestamp function will cause exceptions. However, I'd like to make my application more robust and immune to this kind of problems, and know exactly which format mask to use for exactly what columns in db table.
    Is there a way in a table column to specify the format mask for date/timestamp columns such that I can know exactly what format mask to use when doing conversion? Also I don't want to depend on NLS_DATE_FORMAT specification, don't want to make a long case statement to check for every date format allowed by Oracle.
    Many thanks.

    As per my knowledge it can't be possible
    casuse if you entered '12/11/2007' date
    how oracle know that in date 12'th is the month or 11'th.
    The person who entered that date will also have confusions in future.
    either you have to fix one date format for your whole application (application configuration).
    or you have to store the date format in other column of the table.
    In case you set the date column to varchar and store all the dates without format then
    in future you may face problems in future while fetching the records, searching etc.
    Regards
    Singh

  • JQuery format mask for date columns in tabular form

    Hi,
    How can I apply jQuery format mask for date columns in a tabular form?
    Thanks.
    Andy

    OK, I realized I didn't choose the default type as "Pl/SQL Expression", now it's working correctly.
    Thank you very much!

  • Date mask for Safari

    Has anyone found a mask for date formatting which works with Safari MAC?
    Nick

    in case anyone has this problem (and i've had it for months)
    i finally fixed it: here it goes... the key is to convert it @ the
    gateway w/ the SQL statement for oracle... although its a date you
    need to use TO_CHAR: e.g:
    SELECT TO_CHAR(plans.sip_effective_dt, 'MM/DD/YYYY') as
    sip_effective_dt
    HOPE THIS HELPS ANYONE!

  • Effective format for dates in a JFormattedTextField

    Hello!
    How can I configure a JFormattedTextField to accept dates while showing the mask for dates? I mean, the first time, when the field is empty, it shows only the mask: __/__/___. When the user edit the field it automatically skips the literal characters, going to the place of the numbers. I don't want to force the user to type the date separator characters. I don't want to do just something like this:
    DateFormat format =  new SimpleDateFormat("yyyy/MM/dd");
    DateFormatter df = new DateFormatter(format);
    JFormattedTextField ftf1 = new  JFormattedTextField(df);
    ftf1.setValue(new Date());This code doesn't really adds the '/' as a mask.
    Thank you.
    Marcos

    Like a mentioned before there is are data pickers out
    there that make is one line for the programmer and
    even easier for the user. (Who want to type in a
    date).I don't want to user thirdy party components just to handle dates.
    Basic things should be simple. Why?Because we do them all the time. The Java language is simple. I'm just complaining about the Swing API.
    In programming, I have found that instead that things
    that should be simple normally aren't.
    I agree with you, but a component that just accept dates with a mask for dates is a simple thing today and always will be. Why don't provide an easy way for you to accomplish this?
    Everyday things should be simple.
    Why this API is so taugh? I don't know what taugh means.
    I mean hard to use.
    It s a pain to program in Swing, it even hurts. Have you ever tried AWT?,
    We loose a big time searching for ways to do simplethings.
    Sorry to here, that, but it sounds like a personal
    problem. Use, the API, the tutorials, and pratice
    practice pratice.
    I think that Swing, even with its problems, is the right visual api to use. I'm just saying that it makes you write lots of code to things that could be done with less code.
    I think you will find that Swing's inabitlity to be
    simple allows it to be very flexiable.
    I know, its flexible, but most of the time we don't need the flexibility that it offers. Most of the time we are doing basic things and should use its flexibility only when needed.

  • How to create locale independent masked JFormattedTextField for date?

    I need to create formatted text field with mask for entering date. Mask must be deduced from current locale setting.
    For example US locale has this: "06/28/2005", but czech has "28.6.2005".
    Attention: czech hasn't zero before 6, so day or month length may vary from 1 to 2 characters, not only 2 characters as US, and month and day positions are swapped.
    How to create date parsing from JFormattedTextField locale independent, including mask generating?
    Thank you,
    Tony

    E.g.
    JFormattedTextField tf = new JFormattedTextField();
    tf.setValue(new Date());/Kaj

  • Format mask for Numeric and Data data

    1)Is there any way to suppress timestamp for 12:00:00 value from a date column with TO_CHAR? except that value we should display time value for date column, like this
                 01/12/2009 01:15:01  , 01/12/2009 12:00:00
                 this should be like
                 01/12/2009 01:15:01 , 01/12/2009
                 2) Can I display "0." decimal infornt of numeric value? I used to_char('0.1','9999990.99') , but its displays leading spaces How can I toggle fm for numeric values ?
    Thanks,
    Hesh.
    Edited by: Hesh on Jun 23, 2009 12:27 AM

    A slight change to Michael's query (corrected a small typo)
    SQL> WITH test_tab
      2         AS (SELECT   SYSDATE date_col FROM DUAL
      3             UNION ALL
      4             SELECT   TO_DATE ('26/06/2009 12:00:00', 'DD/MM/YYYY hh24:MI:SS')
      5               FROM   DUAL)
      6               -- end test data
      7  SELECT   date_col,
      8           TO_CHAR (
      9              date_col,
    10              CASE
    11                 WHEN TO_CHAR (date_col, 'hh24:mi:ss') = '12.00.00'  -- typo error '.' instead of ':'
    12                 THEN
    13                    'dd.mm.rrrr'
    14                 ELSE
    15                    'dd.mm.rrrr hh24:mi:ss'
    16              END
    17           )
    18              dt
    19    FROM   test_tab
    20    /
    DATE_COL             DT
    23-JUN-2009 13:29:42 23.06.2009 13:29:42
    26-JUN-2009 12:00:00 26.06.2009 12:00:00
    2 rows selected.
    -- corrected query --
    SQL>   WITH test_tab
      2         AS (SELECT   SYSDATE date_col FROM DUAL
      3             UNION ALL
      4             SELECT   TO_DATE ('26/06/2009 12:00:00', 'DD/MM/YYYY hh24:MI:SS')
      5               FROM   DUAL)
      6               -- end test data
      7  SELECT   date_col,
      8           TO_CHAR (
      9              date_col,
    10              CASE
    11                 WHEN TO_CHAR (date_col, 'hh24:mi:ss') = '12:00:00'
    12                 THEN
    13                    'dd.mm.rrrr'
    14                 ELSE
    15                    'dd.mm.rrrr hh24:mi:ss'
    16              END
    17           )
    18              dt
    19    FROM   test_tab
    20  /
    DATE_COL             DT
    23-JUN-2009 13:29:44 23.06.2009 13:29:44
    26-JUN-2009 12:00:00 26.06.2009
    2 rows selected.
    SQL>Regards,
    Jo

  • Data length for Date is 7 in all_tabs_columns

    I am fetching data_length, data_type from all_tabs_columns for a table in my schema. It is returning data_length=7 for data_type='date'. When i am fetching records based upon this information using SQL_EXECUTE package, the date record returned is of format DD-MON-YY. ie for date '01-JAN-1949', it is fetching '01-JAN-49'.
    Please Suggest.

    Dear Francois,
    I might not be able to exlplain it properly but the problem is when i am executing the query in SQL*Plus, I can retrive the correct data(as'01-JAN-1949'). But when when the same query is executed using a EXEC_SQL package of forms 6i, the data returned is incorrect('01-JAN-2049'/'01-JAN-0049'depending upon the format mask-RRRR/YYYY).
    I think there is some issue related to Dynamic SQL being used in EXEC_SQL package may be with EXEC_SQL.DEFINE_COLUMN or EXEC_SQL.COLUMN_VALUE or EXEC_SQL.EXECUTE???
    Please Suggest.

  • Masking the data in the Table

    Hi,
    Please help me in masking the data in few of the Oracle Apps base table columns data.
    Example : I want to print xxxxxx for the Birth Date column from the per_all_people_f table If I query from the TOAD.
    From Application using Form Personalization I am able to print xxxxx for the required fields.
    Regards,
    Suneel

    Hi Sri,
    I want the output as shown below
    select empno , deptno, deptname from emp;
    OR
    select * from emp ( here I am not using any concatenatin xxxxxx) simply I have given 'Select * from EMP'
    output:
    empno dept no detpname
    1          100       xxxxx
    2           101      xxxxxx
    Here I want the deptname should not show its values its should hide the values and shoudl show xxxxx ..
    As per your query(Sri) I should not create any view and use that view, but I have to use only the  base tables like per_all_people_f ..Like select * from per_all_people_f ..
    The sole idea or requirement is to hide the data in few columns even if we query base table with selct * from base tables
    Regards,
    Sunee

  • Masking Sensitive Data in SAP

    Hey Experts.  Can someone tell me how we can "Mask" certain data in SAP, using Standard functionality.  We don't want to customize, so if a way exists, please share.
    We want to be able to blank out or mask data such as the description of the WBS Elements.
    Thanks.
    Chris
    Edited by: Christopher Ambrose on Oct 29, 2009 6:27 PM

    With SHD0, you create variants which you can use in a number of ways.
    The main ones are:
    1. Modify the use of the standard transaction
    2. Create a new transaction which uses the variant.
    With option 1, everyone who runs the transaction gets the modification
    With option 2, you create a custom transaction and assign it to the variant.  When someone runs the custom tcode, it executes the original transaction but applies the variant to that.  You are not actually copying any transactions etc but it does let you have 2 different types of functionality hanging off the original transaction depending on the transaction you used to access it.
    If you want to use different variants for the standard transaction, you could look into variant groups.  I've not used these before but it may be an option: http://help.sap.com/saphelp_nw04s/helpdata/en/46/8ad19434a801dce10000000a1553f7/frameset.htm
    There are also downsides to using transaction variants, if you do a search on SHD0 there are a few posts on their drawbacks.

  • [svn] 3727: Fix masking for GraphicElements

    Revision: 3727
    Author: [email protected]
    Date: 2008-10-17 15:34:12 -0700 (Fri, 17 Oct 2008)
    Log Message:
    Fix masking for GraphicElements
    SDK-17337 Masking broken for GraphicElements
    We no longer attach the mask to the GraphicElement's parent. Because the mask can not be a child of the maskee, we create a new drawnDisplayObject and attach it and the mask to the displayObject property.
    QE Notes: None
    Doc Notes: None
    Bugs: SDK-17337
    Reviewer: Glenn
    Ticket Links:
    http://bugs.adobe.com/jira/browse/SDK-17337
    http://bugs.adobe.com/jira/browse/SDK-17337
    Modified Paths:
    flex/sdk/trunk/frameworks/projects/flex4/src/mx/components/DataGroup.as
    flex/sdk/trunk/frameworks/projects/flex4/src/mx/components/Group.as
    flex/sdk/trunk/frameworks/projects/flex4/src/mx/components/baseClasses/GroupBase.as
    flex/sdk/trunk/frameworks/projects/flex4/src/mx/graphics/IGraphicElement.as
    flex/sdk/trunk/frameworks/projects/flex4/src/mx/graphics/IGraphicElementHost.as
    flex/sdk/trunk/frameworks/projects/flex4/src/mx/graphics/graphicsClasses/GraphicElement.a s

  • MaskFormatter for date

    hi,
    I need to set DateFormat for date (dd/mm/yyyy) and meanwhile JFormattedTextField must have the MaskFormatter ##/##/####
                         MaskFormatter formatter = new MaskFormatter("##/##/####");
                         formatter.setValidCharacters("0123456789");
                         formatter.setPlaceholderCharacter('.');
                         masktxtDate = new JFormattedTextField(formatter);this sets only mask and how can I add the dateFormat also
    SimpleDateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy");

    ok,
    now I have another task to solve masktxtDate.setValue(string) puts nothing in the formatted textfield and also deletes the mask, where is my fault?

  • Ip addressing for data center

    can you suggest me which pool we use for data center public or private,which is best one

    You will encounter conflicts ONLY if you are connecting to a network that is using your same address space. See more below.
    The private IP addresses that you assign for a private network (inter-office LAN, Internet Service Provider customer bases, campus networks, etc) should fall within the following three blocks of the IP address space:
    10.0.0.1 to 10.255.255.255, which provides a single Class A network of addresses, which would use subnet mask 255.0.0.0.
    (theoretically up to 16,777,215 addresses, good for VERY large enterprises like internet service providers or other global deployment)
    172.16.0.1 to 172.31.255.254, which provides 16 contiguous Class B network addresses, which would use subnet mask 255.255.0.0.
    (theoretically up to 1,048,576 addresses, good for large enterprises like colleges and governmental organizations)
    192.168.0.1 to 192.168.255.254, which provides up to 2^16 Class C network addresses, which would use subnet mask 255.255.255.0.
    (theoretically up to 65,536 addresses, widely used by default in consumer/retail networking equipment)
    Explanation of Subnet masks, Network classes, and other technical info is readily available on the internet.

  • Input Masks for one field

    Hi,
    Can I assign different input masks for one field on a presentation?
    Thanks

    Hi vijay,
    1. U have not given proper parameters
       while calling the FM.
    2. have a look at this (just copy paste)
    3.
    REPORT ABC.
    DATA : BEGIN OF ITAB OCCURS 0,
    UNAME LIKE USR01-BNAME,
    END OF ITAB.
    data : RETURN_TAB LIKE DDSHRETVAL occurs 0 .
    data : RETURN_wa LIKE DDSHRETVAL .
    PARAMETERS : A(12) TYPE C.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR A.
    ITAB-UNAME = 'U01'. APPEND ITAB.
    ITAB-UNAME = 'U02'. APPEND ITAB.
    ITAB-UNAME = 'U03'. APPEND ITAB.
    CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
    EXPORTING
    DDIC_STRUCTURE = ' '
    retfield = 'ITAB-UNAME'
    PVALKEY = ' '
    DYNPPROG = SY-REPID
    DYNPNR = SY-DYNNR
    DYNPROFIELD = 'A'
    STEPL = 0
    WINDOW_TITLE =
    VALUE = ' '
    VALUE_ORG = 'S'
    MULTIPLE_CHOICE = ' '
    DISPLAY = ' '
    CALLBACK_PROGRAM = ' '
    CALLBACK_FORM = ' '
    MARK_TAB =
    IMPORTING
    USER_RESET =
    tables
    value_tab = ITAB
    FIELD_TAB = FTAB
    RETURN_TAB = return_tab
    DYNPFLD_MAPPING =
    EXCEPTIONS
    PARAMETER_ERROR = 1
    NO_VALUES_FOUND = 2
    OTHERS = 3
    break-point.
    regards,
    amit m.

  • JFormattedTextField with edit and display formatter for date

    How can I have a date display formatter and a edit mask date formatter for JFormattedTextField instance.
    When I do
                   DateFormatter dateFormatter = new DateFormatter(new SimpleDateFormat("dd/MM/yyyy"));
                   JFormattedTextField.AbstractFormatterFactory factory = new DefaultFormatterFactory(dateFormatter, dateFormatter, dateFormatter);
                   jFormattedTextField_2.setFormatterFactory(factory);
    all is okie but I wanna a mask formatter and if I do
                   DateFormatter dateFormatter = new DateFormatter(new SimpleDateFormat("dd/MM/yyyy"));
                   MaskFormatter editFormater = new MaskFormatter();
                   try {
                        editFormater.setMask("##/##/####");
                   } catch (ParseException e) {
                        e.printStackTrace();
                   editFormater.setPlaceholderCharacter('_');               
                   JFormattedTextField.AbstractFormatterFactory factory = new DefaultFormatterFactory(dateFormatter, dateFormatter, editFormater);
                   jFormattedTextField_2.setFormatterFactory(factory);
    jFormattedTextField_2 accepts invalid date.
    What can I do to have a date edit mask and a date display mask for a
    JFormattedTextField instance.
    Thx a lot, Tony.

    txtdatnalzaproizvoid = new JFormattedTextField(datformater("##/##/##"));
    txtdatnalzaproizvoid.setValue(datumformat());
    public static MaskFormatter datformater(String formatnavnes){
    MaskFormatter formatter = null;
    try {
    formatter = new MaskFormatter(formatnavnes);
    formatter.setValidCharacters("0123456789");
    } catch (java.text.ParseException exc) {
    System.err.println("formatter is bad: " + exc.getMessage());
    System.exit(-1);
    return formatter;
    public static String datumformat(){
    Date dddd = new Date();
    SimpleDateFormat formatter = new SimpleDateFormat("dd/MM/yy");
    datumformat = formatter.format(dddd);
    return datumformat;
    }

Maybe you are looking for

  • Creation of tab page in customer master

    Please giude me how to create a new tab page in a customer master

  • Download assistant is not working?

    I have tried several times to download the asistant tool and nothing happens.  What should I do?

  • File  Adapter :- Handling Large documents

    Hi I am currently working on File Adapter. Reading large documents and writing the same in to some other file location. I came across the following techniques: 1. Scalable DOM 2. File Chunk Read. Can any one help me the exact use cases of the above m

  • Firefox is being mean to my design

    My web design works beautifully in IE but giving me grief in Firefox.  On my website on the menu bar one of the tabs lettering is not viewing.  Example the tab should be reading "Residential" it is only viewing the "R".   What is up?

  • Problems when downloading VSD or PPM file types

    Hi, when we try to download fiels from collaboration server, getting the SSL prompt when trying to download either VSD or PPM file types, all other open just fine. Did any comeacross such kind of problem and any workaround. Thanks, Ramesh