Date in mm/dd/yyyy format

I have a dunning output that is prodcuing the date in mm/dd/yyyy format despite the user settings being dd/mm/yyyy - and there is no set country command on the form - any ideas of why this is occuring or how I change it.

Hi,
This can be because at time the date settings can be pulled from customer records.
For example. In SPRO you can configure date settings based on countries.
So if your customer belongs to XXXX country then it can pick up the date settings from SPRO.
You can check with a functional guy for the node where you do settings for different countries.
I will try and send you the details later as i dont have system handy.
Thanks

Similar Messages

  • How to Insert date in 'DD/MM/YYYY' format in oracle using stored procedure?

    Hi
    How to Insert date in 'DD/MM/YYYY' format in oracle using stored procedure?
    This is my Input data.
    11/25/2007.
    By using below query, it is inserted into database.
    sql>Insert into tblname values(to_date('11/25/2007','MM/DD/YYYY'));
    But using stored procedure, the same query is not running.
    It shows error like
    ORA-01843: not a valid month ORA-06512: at line 1
    Procedure:
    create or replace procedure Date_Test(datejoin in DATE) is
    begin
    insert into datetest values(to_date(datejoin,'MM/DD/YYYY'));
    end Date_Test;
    I had used 'nls_date_language = american' also.
    Prcodeure is created but not worked in jsp. The same error is thrown.
    Pls provide a solution

    This might help you....
    SQL> Create Table DateTest(col1 Date);
    Table created.
    Elapsed: 00:00:00.00
    SQL> create or replace procedure Date_Test(datejoin in DATE) is
    2 begin
    3 insert into datetest values(to_date(datejoin,'MM/DD/YYYY'));
    4 end ;
    5 /
    Procedure created.
    Elapsed: 00:00:00.00
    SQL> exec Date_Test('11/25/2007');
    BEGIN Date_Test('11/25/2007'); END;
    ERROR at line 1:
    ORA-01843: not a valid month
    ORA-06512: at line 1
    Elapsed: 00:00:00.00
    SQL> exec Date_Test(To_Date('11/25/2007','mm/dd/yyyy'));
    BEGIN Date_Test(To_Date('11/25/2007','mm/dd/yyyy')); END;
    ERROR at line 1:
    ORA-01843: not a valid month
    ORA-06512: at "CTBATCH.DATE_TEST", line 3
    ORA-06512: at line 1
    Elapsed: 00:00:00.00
    SQL> create or replace procedure Date_Test(datejoin in DATE) is
    2 begin
    3 insert into datetest values(datejoin);
    4 end ;
    5 /
    Procedure created.
    Elapsed: 00:00:00.00
    SQL> exec Date_Test(To_Date('11/25/2007','mm/dd/yyyy'));
    PL/SQL procedure successfully completed.
    Elapsed: 00:00:00.00
    SQL> Select * from DateTest;
    COL1
    25-NOV-07
    Elapsed: 00:00:00.00
    SQL> create or replace procedure Date_Test(datejoin in VarChar2) is
    2 begin
    3 insert into datetest values(to_date(datejoin,'mm/dd/yyyy'));
    4 end ;
    5 /
    Procedure created.
    Elapsed: 00:00:00.00
    SQL> exec Date_Test('11/25/2007');
    PL/SQL procedure successfully completed.
    Elapsed: 00:00:00.00
    SQL> select * from DateTest;
    COL1
    25-NOV-07
    25-NOV-07
    Elapsed: 00:00:00.00
    SQL>

  • How to convert date  into dd mon yyyy format

    hi all,
    i have a problem in date format i am using date like below .
    <%java.util.Date date = new java.util.Date();%>
    i am inserting date into a table and its storing like this
    insert into tablename (d_date) values (date)
    and its inserting date like below
    Sun Oct 19 09:05:45 GMT+03:00 2003
    i want to fetch date in dd mon yyyy format.
    with this format i want to make a select query.i struck with the format conversion.
    how to do this.
    any comments please.
    any help

    hi all,
    i understand now where i am wrong.
    the below code is not working why because in my server where i am executing code the regional setting month value is in arabic.
    i executed the same code in a different server where date and time jones are english its working fine.
    All the problem is in regional setting and not the jsp code.
    <%
    String whtEverDateFormatYouWAnt = "dd MMM yy";
    String str = new SimpleDateFormat(whtEverDateFormatYouWAnt).format(new SimpleDateFormat("EEE MMM dd HH:mm:ss vvv yyyy").parse("Sun Oct 19 09:05:45 GMT+03:00 2003"));
    out.print(str);
    %>
    Thanks a lot for the excellent solution.
    Thanks again.

  • How to get date in dd/mm/yyyy format ?

    Hello,
    for this query :
    >select to_date(to_char(sysdate),'dd/mm/yyyy') from dual;
    i wanted to get date in dd/mm/yyyy format , but this query is not returning in correct date format .
    How to get that ?

    select id,
    to_date(to_char(dt1,'mm/dd/yyyy'),'dd/mm/yyyy') dt1,
    to_date(to_char(dt2,'mm/dd/yyyy'),'dd/mm/yyyy') dt2
    from t_table1 where no=23;This is my actual query.
    But this query is giving error.
    ORA-01843: not a valid monthWhen i issued this query :
    select id,dt1,dt2 from t_table1 where no=23 ;
    this is the output :
    ID DT1 DT2
    001 10/7/2011 10/19/2011Edited by: bootstrap on Oct 8, 2011 2:13 PM
    Edited by: bootstrap on Oct 8, 2011 2:13 PM

  • Valiadtion of date in dd.mm.yyyy format

    i have a selection screen in which i want user to enter date in dd.mm.yyyy format only.how can i validate that.any FM.
    i also want that date to be changed in yyyymmdd format coz i have to update that in a field which has yyyymmdd format.
    so is there any fm for this also ( to change dd.mm.yyyy to yyyymmdd).
    any pointers will help.

    Hi Govind,
    Based on the user defaults in the transaction SU01 the date will be verified based on the date format selected in the user details.
    Declare the selection screen variable as of type Sy-DATUM.
    what ever format you had entered the date in the selection screen the variable will hold the value in the format yyyymmdd.
    no need to do any format for the date.
    hope this might help you.
    regards,
    Phani.

  • Displaying date in dd/MM/yyyy format

    Hi all,
    I am having one date field .To display the date in correct format, I created a dictionary simple type of type date and entered dd/MM/yyyy in representation tab.
    I was using 2004 and it was working properly. Now I am using 2004s for the same application. The problem is when I am selecting a date , it is showing the date in MM/dd/yyyy format in first time. If I selects the date again, then it will be in dd/MM/yyyy format. How can I make the selection in dd/MM/yyyy in first time itself
    Thanks 
    Fahad Hamsa

    Hi,
       Try this:
    1. Create a simple type in the local dictionary. Call it say, CustomDateType.
    2. Set the built-in type as date.
    3. Go to the representation tab and under "External Representation" set the format to "dd/MM/yyyy".
    4. Create a context value attribute day, CustomDate and set its type to CustomDateType.
    5. Create an inputfield with id say, "DateField" and bind its value property to CustomDate.
    6. Now in your wdDoModifyView() write the following code:
    if(firstTime){
       IWDViewElement e = view.getElement("DateField");
       e.requestFocus();
    Regards,
    Satyajit.

  • Insertion of date in dd-mmm-yyyy format

    I have a jsp page, from that i can enter values in oracle database.
    my jsp page is working, but the problem is that it can only accept the date
    dd-mmm-yyyy format. i.e 20-jun-2004, but when i enter date in dd/mm/yyyy format i.e 20/06/2004, it does not accept.
    i want to enter to do enter date in dd/mm/yyyy format in the form, and it can save the date field in database in dd-mmm-yyyy format.
    my code is as bellow:
    <html>
    <body>
    <table>
    <tr>
    <td>
    <%@ page import =" java.sql.Date.*" %>
    <%@ page import =" java.text.SimpleDateFormat.*" %>
    <%@ page import =" java.util.Date.*" %>
    <%@ page import =" java.text.*" %>
    <%@ page import="javax.servlet.*" %>
    <%@ page import="javax.servlet.http.*" %>
    <%@ page language="java" import="java.sql.*" %>
    <%
    try {
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    Connection conn=DriverManager.getConnection("jdbc:odbc:pf","scott","ttlscott");
    System.out.println("got connection");
    %>
    <%
    char pay_post,pay_type;
    String action = request.getParameter("action");
    if (action != null && action.equals("save")) {
    conn.setAutoCommit(false);
    PreparedStatement pstmt = conn.prepareStatement(
    ("INSERT INTO pay_header VALUES (?, ?, ?, ?, ?, ?,?,?)"));
    pstmt.setString(1,request.getParameter("vou_no"));
    pstmt.setString(2,request.getParameter("pay_date"));
    pstmt.setString(3,request.getParameter("pay_post"));
    pstmt.setString(4,request.getParameter("pay_narr"));
    pstmt.setString(5, request.getParameter("chq_no"));
    pstmt.setString(6,request.getParameter("chq_date"));
    pstmt.setFloat(7,Float.parseFloat(request.getParameter("chq_amt")));
    pstmt.setString(8,request.getParameter("pay_type"));
    pstmt.executeUpdate();
    conn.commit();
    conn.setAutoCommit(true);
    %>
    <%
    Statement statement = conn.createStatement();
    ResultSet rs = statement.executeQuery
    ("SELECT * FROM pay_header ");
    %>
    <tr>
    <form action="payment_save1.jsp" method="get">
    <input type="hidden" value="save" name="action">
    <th><input value="" name="vou_no" size="10"></th>
    <th><input value="" name="pay_date" size="10"></th>
    <th><input value="" name="pay_post" size="15"></th>
    <th><input value="" name="pay_narr" size="15"></th>
    <th><input value="" name="chq_no" size="15"></th>
    <th><input value="" name="chq_date" size="15"></th>
    <th><input value="" name="chq_amt" size="15"></th>]
    <th><input value="" name="pay_type" size="15"></th>
    <th><input type="submit" value="save"></th>
    </form>
    </tr>
    <%
    while ( rs.next() ) {
    %>
    <tr>
    <form action="payment_save1.jsp" method="get">
    <input type="hidden" value="save" name="action">
    <td><input value="<%= rs.getString("vou_no") %>" name="vou_no"></td>
    <td><input value="<%= rs.getDate("pay_date") %>" name="gl_descr"></td>
    <td><input value="<%= rs.getString("pay_post") %>" name="pay_post"></td>
    <td><input value="<%= rs.getString("pay_narr") %>" name="pay_narr"></td>
    <td><input value="<%= rs.getString("chq_no") %>" name="chq_no"></td>
    <td><input value="<%= rs.getDate("chq_date") %>" name="chq_date"></td>
    <td><input value="<%= rs.getFloat("chq_amt") %>" name="chq_amt"></td>
    <td><input value="<%= rs.getString("pay_type") %>" name="pay_type"></td>
    <td><input type="submit" value="save"></td>
    </form>
    </tr>
    <%
    %>
    </table>
    <%
    // Close the ResultSet
    rs.close();
    // Close the Statement
    statement.close();
    // Close the Connection
    conn.close();
    } catch (SQLException sqle) {
    out.println(sqle.getMessage());
    } catch (Exception e) {
    out.println(e.getMessage());
    %>
    </td>
    </tr>
    </body>
    </html>

    thanx for u r help..
    now i have used simple date format method and also apllied setDate() method.
    bit its coming error NULL
    code:
    SimpleDateFormat sdf = new SimpleDateFormat("dd/mm/yyyy");
    java.util.Date pay_date_temp = null;
    java.util.Date pay_post_temp = null;
    PreparedStatement pstmt = conn.prepareStatement(
    ("INSERT INTO pay_header VALUES (?, ?, ?, ?, ?, ?,?,?)"));
    java.sql.Date pay_date = new java.sql.Date(pay_date_temp.getTime());
    java.sql.Date chq_date = new java.sql.Date(pay_post_temp.getTime());
    pstmt.setString(1,request.getParameter("vou_no"));
    pstmt.setDate(2,pay_date);
    pstmt.setString(3,request.getParameter("pay_post"));
    pstmt.setString(4,request.getParameter("pay_narr"));
    pstmt.setString(5, request.getParameter("chq_no"));
    pstmt.setDate(6,chq_date);
    pstmt.setFloat(7,Float.parseFloat(request.getParameter("chq_amt")));
    pstmt.setString(8,request.getParameter("pay_type"));
    help me

  • Insert date in dd-mmm-yyyy format

    I have a jsp page, from that i can enter values in oracle database.
    my jsp page is working, but the problem is that it can only accept the date
    dd-mmm-yyyy format. i.e 20-jun-2004, but when i enter date in dd/mm/yyyy format i.e 20/06/2004, it does not accept.
    i want to enter to do enter date in dd/mm/yyyy format in the form, and it can save the date field in database in dd-mmm-yyyy format.
    my code is as bellow:
    <html>
    <body>
    <table>
    <tr>
    <td>
    <%@ page import =" java.sql.Date.*" %>
    <%@ page import =" java.text.SimpleDateFormat.*" %>
    <%@ page import =" java.util.Date.*" %>
    <%@ page import =" java.text.*" %>
    <%@ page import="javax.servlet.*" %>
    <%@ page import="javax.servlet.http.*" %>
    <%@ page language="java" import="java.sql.*" %>
    <%
    try {
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    Connection conn=DriverManager.getConnection("jdbc:odbc:pf","scott","ttlscott");
    System.out.println("got connection");
    %>
    <%
    char pay_post,pay_type;
    String action = request.getParameter("action");
    if (action != null && action.equals("save")) {
    conn.setAutoCommit(false);
    PreparedStatement pstmt = conn.prepareStatement(
    ("INSERT INTO pay_header VALUES (?, ?, ?, ?, ?, ?,?,?)"));
    pstmt.setString(1,request.getParameter("vou_no"));
    pstmt.setString(2,request.getParameter("pay_date"));
    pstmt.setString(3,request.getParameter("pay_post"));
    pstmt.setString(4,request.getParameter("pay_narr"));
    pstmt.setString(5, request.getParameter("chq_no"));
    pstmt.setString(6,request.getParameter("chq_date"));
    pstmt.setFloat(7,Float.parseFloat(request.getParameter("chq_amt")));
    pstmt.setString(8,request.getParameter("pay_type"));
    pstmt.executeUpdate();
    conn.commit();
    conn.setAutoCommit(true);
    %>
    <%
    Statement statement = conn.createStatement();
    ResultSet rs = statement.executeQuery
    ("SELECT * FROM pay_header ");
    %>
    <tr>
    <form action="payment_save1.jsp" method="get">
    <input type="hidden" value="save" name="action">
    <th><input value="" name="vou_no" size="10"></th>
    <th><input value="" name="pay_date" size="10"></th>
    <th><input value="" name="pay_post" size="15"></th>
    <th><input value="" name="pay_narr" size="15"></th>
    <th><input value="" name="chq_no" size="15"></th>
    <th><input value="" name="chq_date" size="15"></th>
    <th><input value="" name="chq_amt" size="15"></th>]
    <th><input value="" name="pay_type" size="15"></th>
    <th><input type="submit" value="save"></th>
    </form>
    </tr>
    <%
    while ( rs.next() ) {
    %>
    <tr>
    <form action="payment_save1.jsp" method="get">
    <input type="hidden" value="save" name="action">
    <td><input value="<%= rs.getString("vou_no") %>" name="vou_no"></td>
    <td><input value="<%= rs.getDate("pay_date") %>" name="gl_descr"></td>
    <td><input value="<%= rs.getString("pay_post") %>" name="pay_post"></td>
    <td><input value="<%= rs.getString("pay_narr") %>" name="pay_narr"></td>
    <td><input value="<%= rs.getString("chq_no") %>" name="chq_no"></td>
    <td><input value="<%= rs.getDate("chq_date") %>" name="chq_date"></td>
    <td><input value="<%= rs.getFloat("chq_amt") %>" name="chq_amt"></td>
    <td><input value="<%= rs.getString("pay_type") %>" name="pay_type"></td>
    <td><input type="submit" value="save"></td>
    </form>
    </tr>
    <%
    %>
    </table>
    <%
    // Close the ResultSet
    rs.close();
    // Close the Statement
    statement.close();
    // Close the Connection
    conn.close();
    } catch (SQLException sqle) {
    out.println(sqle.getMessage());
    } catch (Exception e) {
    out.println(e.getMessage());
    %>
    </td>
    </tr>
    </body>
    </html>

    thanx for u r help..
    now i have used simple date format method and also apllied setDate() method.
    bit its coming error NULL
    code:
    SimpleDateFormat sdf = new SimpleDateFormat("dd/mm/yyyy");
    java.util.Date pay_date_temp = null;
    java.util.Date pay_post_temp = null;
    PreparedStatement pstmt = conn.prepareStatement(
    ("INSERT INTO pay_header VALUES (?, ?, ?, ?, ?, ?,?,?)"));
    java.sql.Date pay_date = new java.sql.Date(pay_date_temp.getTime());
    java.sql.Date chq_date = new java.sql.Date(pay_post_temp.getTime());
    pstmt.setString(1,request.getParameter("vou_no"));
    pstmt.setDate(2,pay_date);
    pstmt.setString(3,request.getParameter("pay_post"));
    pstmt.setString(4,request.getParameter("pay_narr"));
    pstmt.setString(5, request.getParameter("chq_no"));
    pstmt.setDate(6,chq_date);
    pstmt.setFloat(7,Float.parseFloat(request.getParameter("chq_amt")));
    pstmt.setString(8,request.getParameter("pay_type"));
    help me

  • Please enter the expiry date in dd.mm.yyyy format

    Dear All,
    I have configured SAP AA in Dev. Now I want to craete asset master. But it is showing the following error, when I am going to save:
    Please enter the expiry date in dd.mm.yyyy format
    Can anyone tell me the solution?
    Thanks
    Azimul

    Thanks Jigar for your reply.
    My company is using SAP last 2.5 years. During SAP Implementation, Consultants configured SAP AA, but during testing it showed error in Asset Accounting. That is why, we donu2019t use SAP AA.
    Now we want to use Asset Accounting in SAP. I have configured SAP AA in Development. Then I try to Create Asset Master, But it is showing Error:
    Please enter the expiry date in dd.mm.yyyy format
    I cannot get Error message no also. If I double click on error, it is not opening.
    I donu2019t know about Validations. Can u please guide me?
    Thanks,
    Azimul
    Edited by: Azimul on Oct 1, 2011 7:58 AM

  • Converting string to date in mm/dd/yyyy format

    Hi,
    I used simpledateformat to convert date to "MM/dd/yyyy" format.
    Now when i want to insert into db, i want the value as date object instead of string [returned by format method of SimpleDateFormat]
    what should i do?
    Date dt = new Date();
    SimpleDateFormat sdf = new SimpleDateFormat("MM/dd/yyyy");
    System.out.println("Formatted date is coming as "+sdf.format(dt));
    Date dt1 = sdf.parse(sdf.format(dt);
    System.out.println("parsed date is coming as " +dt1);
    output :
    1 SOP returns 11/07/2007 [current date]
    2 SOP returns Wed Nov 07 00:00:00 GMT+05:30 2007

    If you are using PreparedStatements setDate method, you need a java.sql.Date object, not a Java.util.Date object. You can create an sql.Date object from a util.Date object as follows:
    java.sql.Date sqlDate = new java.sql.Date(dt.getTime());And, if you are not using PreparedStatement and its setDate method, then change now.
    Doing
    Date dt1 = sdf.parse(sdf.format(dt));is meaningless. You format the date to string, then parse the string back to a date? Why? Why not just use the original Date object? And you won't get a sql.Date object that way, either, as the DateFormat classes return a util.Date object.
    Edit: And for more info:
    A Date does not have a format. It is simply a number. The "format" only comes into play when printing the String representation of the Date, and that is not handled by the Date object itself (except when calling toString either explicitly or implicitly).

  • Calculate future date in MM/dd/yyyy format

    Hi,
    I am trying to add a 56 months to a given date (MM/dd/yyyy string) and output the date in MM/dd/yyyy format.
    Here is my code:
                   SimpleDateFormat date = new SimpleDateFormat("MM/dd/yyyy");
                   date.parse("07/30/2000");
                   GregorianCalendar gc = new GregorianCalendar();
                   gc.add(Calendar.MONTH,+56);
                   System.out.println(date.format(gc.getTime()));  I tried to assign date.parse() to a Date but there is no fomat method on Date so to add months to the date. Could someone suggest me how to calculate a future date?

    thanks for looking, just found the answer:
                   SimpleDateFormat date = new SimpleDateFormat("MM/dd/yyyy");
                   Date dt = date.parse("07/30/2000");
                   GregorianCalendar gc = new GregorianCalendar();
                   gc.setTime(dt);         //this was missing
                   gc.add(Calendar.MONTH,+56);
                   System.out.println(date.format(gc.getTime()));

  • How to convert system Date into DD-MMM-YYYY Format

    hi friends,
    please help me How to convert system Date into DD-MMM-YYYY Format.
    Regards
    Yogesh

    HI..
    data: w_dt(11) type c,
             w_month(2),
             w_mon(3).
    w_month = p_date+4(2). **p_date = given date**
    case w_month.
    when '01'.
    w_mon = 'Jan'.
    when '02'.
    w_mon = 'Feb'.
    when '03'.
    w_mon = 'Mar'.
    when '04'.
    w_mon = 'Apr'.
    when '05'.
    w_mon = 'May'.
    when '06'.
    w_mon = 'Jun'.
    when '07'.
    w_mon = 'Jul'.
    when '08'.
    w_mon = 'Aug'.
    when '09'.
    w_mon = 'Sep'.
    when '10'.
    w_mon = 'Oct'.
    when '11'.
    w_mon = 'Nov'.
    when '12'.
    w_mon = 'Dec'.
    endcase.
    Now...
      concatenate p_date6(2)  '-'  w_mon  '-'   p_date0(4)  into w_dt.
    write w_dt.

  • Convert java.sql.date to dd.mm.yyyy format

    Hi,
    Can any one tell me how to convert java.sql.date to dd.mm.yyyy format
    Regards,
    H.V.Swathi

    Hi ,
    Create a simple data type of type java.sql.date and give the format in it as "dd/MM/yyyy". This will work i guess.
    Regards
    Ishita

  • Show date in dd/mm/yyyy format using ODataModel in a table.

    Hi,
    I am populating a table using ODataMoel in which one of the columns is 'DatePicker' control and I want to map a date being passed in one of the fields of data from server to this DatePicker control. It's getting mapped but I want to show the date in DatePicker in 'dd/mm/yyyy' format.
    I happened to go through links but they were talking about JSonModel.
    How would that be implemented using ODataModel. Please find my sample code below.
    var oTable = new sap.ui.table.Table("dprTable",{
      visibleRowCount: 4,
      //firstVisibleRow: 3,
      visible: true,
      navigationMode: sap.ui.table.NavigationMode.Paginator
      //selectionMode: sap.ui.table.SelectionMode.Single
    var oColumn = new sap.ui.table.Column({
      label: new sap.ui.commons.Label({text: "DBR/DPR"}),
      template: new sap.m.Link({
      "target": "_blank",
      press:[controller.onClickDemoNo,controller]
      }).bindProperty("text","DemoId")
      width: "auto"
    oTable.addColumn(new sap.ui.table.Column({
      label: new sap.ui.commons.Label({text: "Required Date"}),
      template: new sap.ui.commons.DatePicker("",{
      value:{
      path:"/ReqDate",
      type: new sap.ui.model.type.Date({pattern: "yy-MM-dd"})
      change: function(){
      console.log('the date is changed and it\'s value is'+value);
        width: "auto"
    oTable.addColumn(oColumn);
    var oModel = new sap.ui.model.odata.ODataModel("/sap/opu/odata/sap/ZSECENTRAL_SRV",true);
      oTable.setModel(oModel);
      oTable.bindRows("/DEOPENDBRSet");
    This(red colored code) is not showing the date in the DatePciker in the form of 'dd/mm/yyyy', in fact it's not populating the date too. Any help would be appricitated.
    Thanks,
    Supriya Kale

    Hi Supriya,
    Just give the source pattern of the date and remove the / in the path mentioned.
    Please make sure that the source pattern is correct.
    template = new sap.ui.commons.DatePicker({
    value:{
    path:"ReqDate",
    type: new sap.ui.model.type.Date({source: {pattern: "yyyyMMdd"},pattern: "yy-MM-dd"})
    Hope it works.
    Regards,
    Jeffin George

  • TextField that accepts dates in DD-MM-YYYY format

    I need to create a texfield that accepts dates in DD-MM-YYYY. Also, if the input does not correspond to a date, I want to trap focus in the control....
    Thanks,
    V

    Oops, sorry for the previous post, it is not the code i am using...
    Here it is:
    import com.id.swing.mask.JMaskField;
    import java.awt.Color;
    import java.awt.Dimension;
    import java.text.ParseException;
    import javax.swing.JComponent;
    import java.awt.Toolkit;
    import javax.swing.JOptionPane;
    import java.text.SimpleDateFormat;
    import java.sql.Date;
    import java.util.Locale;
    import java.awt.event.FocusListener;
    import java.awt.event.FocusEvent;
    public class IdDateMask extends JMaskField implements FocusListener {
    protected SimpleDateFormat m_sdfDbPattern;
    protected SimpleDateFormat m_sdfUserPattern;
    protected String m_userDatePattern = "ddMMyy";
    protected String m_mask = "{[0-1]}#/{[0-3]}#/##";
    protected boolean m_canBeNull;
    public IdDateMask(String mask, String userPattern) {
    super(mask);
    super.setLocale(new Locale(System.getProperty("id.pyrites.user.language"),
    System.getProperty("id.pyrites.user.country")));
    m_userDatePattern = userPattern;//ie ddMMyy
    m_canBeNull = true;
    initialize();
    protected void initialize(){
    setForeground(new Color(51, 0, 255));
    setDisabledTextColor(new Color(0, 0, 0));
    setColumns(8);
    setPreferredSize(new Dimension(84,20));
    setMinimumSize(new Dimension(27,20));
    setMaximumSize(new Dimension(128,20));
    m_sdfDbPattern = new SimpleDateFormat("yyyy-MM-dd", getLocale());
    m_sdfUserPattern = new SimpleDateFormat(m_userDatePattern, getLocale());
    m_sdfUserPattern.setLenient(false);
    public void focusGained(FocusEvent e) {
    this.setBackground(new Color(255,204,204));
    public void focusLost(FocusEvent e) {
    isValidDate();
    this.setBackground(Color.WHITE);
    public boolean canBeNull() {
    return m_canBeNull;
    public void setCanBeNull(boolean value) {
    m_canBeNull = value;
    public boolean isValidDate() {
    boolean retVal = false;
    try {
    String theStr = super.getText();//ie: 310802
    if(!canBeNull()) {
    if (theStr.equals("")) throw(new Exception());
    else m_sdfUserPattern.parse(theStr);//ParseException can be thrown here
    } else {
    if(!theStr.equals("")) System.out.println(m_sdfUserPattern.parse(theStr));//ParseException can be thrown here
    return true;
    } catch (ParseException ex) {
    System.out.println("IdDateMask - verifyDate() - ERROR: " + ex.getMessage());
    Toolkit.getDefaultToolkit().beep();
    try {
    JOptionPane.showMessageDialog(IdDateMask.this,
    java.util.ResourceBundle.getBundle("com/id/pyrites/client/resources/Bundle", getLocale()).getString("MSG_DATE_notValid") + m_userDatePattern,
    java.util.ResourceBundle.getBundle("com/id/pyrites/client/resources/Bundle", getLocale()).getString("MSG_DATE_notValidDlgTitle"),
    JOptionPane.ERROR_MESSAGE);
    } catch(Exception e) {
    System.out.println("IdDateMask - verifyDate() - I18N - ERROR: " + e.getMessage());
    JOptionPane.showMessageDialog(IdDateMask.this,
    "MSG_DATE_notValid" + m_userDatePattern,
    "MSG_DATE_notValidDlgTitle",
    JOptionPane.ERROR_MESSAGE);
    // super.setText("");
    // this.requestFocus();
    return false;
    } catch (Exception ex) {
    System.out.println("IdDateMask - verifyDate() - ERROR: " + ex.getMessage());
    Toolkit.getDefaultToolkit().beep();
    try {
    JOptionPane.showMessageDialog(IdDateMask.this,
    java.util.ResourceBundle.getBundle("com/id/pyrites/client/resources/Bundle", getLocale()).getString("MSG_DATE_notNull"),
    java.util.ResourceBundle.getBundle("com/id/pyrites/client/resources/Bundle", getLocale()).getString("MSG_DATE_notNullDlgTitle"),
    JOptionPane.ERROR_MESSAGE);
    } catch(Exception e) {
    System.out.println("IdDateMask - verifyDate() - I18N - ERROR: " + e.getMessage());
    JOptionPane.showMessageDialog(IdDateMask.this,
    "MSG_DATE_notNull",
    "MSG_DATE_notNullDlgTitle",
    JOptionPane.ERROR_MESSAGE);
    // super.setText("");
    // this.requestFocus();
    return false;
    public void setToday() {
    setValue((new Date(System.currentTimeMillis())).toString());
    public void setText(String value) {
    setValue(value);
    public void setValue(String value) {
    if(!(value == null) && (!value.equals(""))) {
    //We receive the yyyy-MM-dd format...
    //The format of the displayed date is m_userDatePattern
    //So, we have to transform YYYY-MM-dd into for example ddMMYY
    //Let's do it.
    try {
    //If the field is empty, a ParseException is thrown
    String valueToDisplay = m_sdfUserPattern.format(m_sdfDbPattern.parse(value));
    super.setText(valueToDisplay);
    //Next we have to localize it according to medium format
    } catch (ParseException ex) {
    System.out.println("IdDateMask - setValue("+ value +") - ERROR: " + ex.getMessage());
    Toolkit.getDefaultToolkit().beep();
    try {
    JOptionPane.showMessageDialog(IdDateMask.this,
    java.util.ResourceBundle.getBundle("com/id/pyrites/client/resources/Bundle", getLocale()).getString("MSG_DATE_notValidInput") + value,
    java.util.ResourceBundle.getBundle("com/id/pyrites/client/resources/Bundle", getLocale()).getString("MSG_DATE_notValidInputDlgTitle"),
    JOptionPane.ERROR_MESSAGE);
    } catch(Exception e) {
    System.out.println("IdDateMask - setValue("+ value +") - I18N - ERROR: " + e.getMessage());
    JOptionPane.showMessageDialog(IdDateMask.this,
    "MSG_DATE_notValidInput" + value,
    "MSG_DATE_notValidInputDlgTitle",
    JOptionPane.ERROR_MESSAGE);
    } else {
    super.setText("");
    public String getText() {
    return getValue();
    public String getValue() {
    //Return date with format yyyy-MM-dd
    //But i have a String of format m_userDatePattern
    try {
    if(canBeNull() && (super.getText().equals(""))) return "";
    else {
    String outputDateStr = m_sdfDbPattern.format(m_sdfUserPattern.parse(super.getText()));
    return outputDateStr;
    } catch (ParseException ex) {
    System.out.println("IdDateMask - getValue() - ERROR: " + ex.getMessage());
    Toolkit.getDefaultToolkit().beep();
    try {
    JOptionPane.showMessageDialog(IdDateMask.this,
    java.util.ResourceBundle.getBundle("com/id/pyrites/client/resources/Bundle", getLocale()).getString("MSG_DATE_notValid") + m_userDatePattern,
    java.util.ResourceBundle.getBundle("com/id/pyrites/client/resources/Bundle", getLocale()).getString("MSG_DATE_notValidDlgTitle"),
    JOptionPane.ERROR_MESSAGE);
    } catch(Exception e) {
    System.out.println("IdDateMask - getValue() - I18N - ERROR: " + e.getMessage());
    JOptionPane.showMessageDialog(IdDateMask.this,
    "MSG_DATE_notValid" + m_userDatePattern,
    "MSG_DATE_notValidDlgTitle",
    JOptionPane.ERROR_MESSAGE);
    return "";
    public void setEnabled(boolean value) {
    super.setEnabled(value);
    //color section
    public void setBackgroundText(Color c) {
    setBackground(c);
    public void setForegroundText(Color c) {
    setForeground(c);

Maybe you are looking for

  • IPod touch wont sync with iTunes. Weird errors!

    Anytime I try to sync anything to my iPod touch, I get one of the following error messages; 1.)Attempting to copy to the disk "Duncan's iPod" failed. There are too many files open currently. 2.)The iPod "Duncan's iPod cannot be synced. An internal de

  • Can anyone split frame into three independent areas with JSplitPane??

    Hi, has anyone tried to use JSplitPane to split JFrame in to 3 different areas? How should it be done correctly? What I have now is two nested JSplitpanes, i.e. I have 'baseSplitPane', which divides frame in two sections, and then I have 'upperSplitP

  • Scanner class refuses to work

    Hi, I am having a really big pain in the butt issue with java, (ive tried using eclipse, jgrasp and bluej, all giving me same error) I am trying to read from a .dat file (which can easily be opened with wordpad or notepad to reveal contents) I am usi

  • Vuze crashes on startup

    Hi guys, when I start Vuze from the Kickoff menu the splashscreen appears and after the progressbar has reached 100 % I can briefly see the main window which then disappears and I'm back to my desktop. When I start Vuze with Konsole, I get this: scho

  • When apple iPhone 4s battery completely drain out and recharge again,no out going or incoming call can be sent or received

    when apple iPhone 4s battery completely drain out and recharge again,no out going or incoming call can be sent or received until rest the phone completly. Do we have any solution for this?