Converting given data to date format

Hi
I have one date field in forms and i want to convert the string into a valid date format whenever i pressed the tab.When i enter 1jan07 it should convert into 01-JAN-2007 when i press the tab.I tried the following code but its not working.I changed the format mask but no use
select to_char(to_date(:DATA.BDATE,'DDMMYY'),'DD-MON-YYYY') into :DATA.BDATE from dual
rgds
shrey

Hi Shrey,
I have checked in one of my form with the format mask DD-MON-RRRR and its working fine.
confirm whether the field is a Date field or a char???
Regards

Similar Messages

  • Need help for FM that converts RAW format data to xls format

    Hi all,
         I am able to get the data from the given spool number to be converted into 'RAW' format. I need to convert this data into Excel format nad want to send the mail as attachment.
         I want to know is there a Function Module that converts this RAW format data into the Excel format?
    regards,
    Brijesh Patel

    Hi,
    instead of that you can do this....
    once spool is generated you have spool number , using the spool number you can generate the excel file using the FM <b>RSPO_DOWNLOAD_SPOOLJOB</b>, pass the spool number, and filename as some.xls and then it will download it to xls file,
    Regads
    vijay

  • Convert Number to the date format

    Hello,
    In CRM, i want to input the number as a parameter and convert the number into Date format. Is there any function module in CRM which accepts the number and gives the date as output .
    Example.
    suppose input given is 734484
    output : 12-12-2011  .
    The number  734484 reflects  the total number of days from '0000' to 12-12-2011
    Regards,
    Rohini

    920575 wrote:
    I have a sql like this:
    select to_date('MAR','Mon', 'NLS_DATE_LANGUAGE=American') m from dualI want to display '3' instead of showing MAR...
    I tried to use to_char(date,'MM') but the result will return '03'.
    I would like to have the output exactly equal to 3.3 (without single-quotes) is a NUMBER. It is exactly equal to the NUMBER 03.
    '3' is a string. It is not equalt to the string '03'.
    Do you want a NUMBER or a string?
    If you want the 1-character string '3', then use 'fmMM' instead of 'MM'.
    select  TO_CHAR ( to_date ('MAR', 'Mon', 'NLS_DATE_LANGUAGE=American')
                    , 'FMMM'
                    )   AS m
    from    dualTO_CHAR sometimes adds padding (sometimes spaces, sometimes '0's) to make elements a constant width. For example, some months need 2 characters for the 'MM' format, so TO_CHAR, by default, left-pads with '0's to make all months 2 characters, whether they need 2 characters or not. Using 'FM' (case insensitive) IN the format string changes whether or not this kind of padding will be added.
    You could also use LTRIM to remove the leading '0's in this case, but why remove them when it's easier not to generate them in the first place?

  • How to convert the numeric to date format

    HI ,
         We have created the date KF and selected the data type as DEC-numeric or counter and add in the cube.
          the data for this fields in the cube are in numerics like  734.504, but when we execute the report it is converted in to date format dd.mm.yyyy.
                    My issue how this conversion is working in the backend while executing the report.
    Regards.
    venkata

    Conversion is happening because of the type you had selected for the KF while creating it.
    Check the type of the Key figure?
    While creating the KF you might have selected the Type as Date and Data type -DEC : Counter or amount field with comma and sign.
    that's the reason why you are getting the output values displayed in dd.mm.yyyy format.
    For amount field - create a KF with type "AMOUNT" and unit -0currency or specify the currency of that region.
    regards
    KP

  • Convert a date in String format to a Date

    Hi,
    How can I convert a date in String format to a Date object?
    I have tried:
    import java.text.*;
    import java.io.*;
    import java.util.Date;
    import java.util.Locale;
    import java.sql.*;
    public class casa {
    public static Connection con = null;
    public static Statement s = null;
    public static String sql = null;
    public static String mydate = "01.01.2001";
    /** Creates a new instance of casa */
    public casa() {
    public static void main(String[] args) throws SQLException{
    try {
    DateFormat shortFormat = DateFormat.getDateInstance(DateFormat.SHORT);
    Date date = shortFormat.parse(mydate);
    //Open Database
    con = getConnection();
    s = con.createStatement();
    sql = "select date1 from table1 where date1 <= '"+date+"'";
    ResultSet rs = s.executeQuery(sql);
    while(rs.next()){
    String aba = rs.getString("datum");
    System.out.println("New Datum = "+aba);
    } catch (Exception ex ) {
    ex.printStackTrace();
    closeConnection(s, con);
    //Connection
    private static Connection getConnection() {
    Connection con = null;
    String user ="aouzi";
    String passe ="aouzi";
    String url = "jdbc:db2:EjbTest";
    try {
    //Datenbanktreiber laden
    Class.forName("COM.ibm.db2.jdbc.app.DB2Driver");
    //Verbindung herstellen
    con = DriverManager.getConnection(url,user,passe);
    }catch(ClassNotFoundException e){
    } catch(SQLException e){}
    return con;
    //close Connection
    private static void closeConnection(Statement s, Connection con) {
    try {
    s.close();
    } catch (SQLException e) {}
    try {
    con.close();
    } catch (SQLException e) {}
    I'm getting the following errors:
    COM.ibm.db2.jdbc.DB2Exception: [IBM][CLI Driver][DB2/NT] SQL0180N
    The syntax of the representation of a date/time of day value as character sequence is false. .SQLSTATE=22007

    I'm pretty sure it won't understand what date.toString() returns. If you know what format the database understands, you do it like this:
    SimpleDateFormat sdf = new SimpleDateFormat("dd-MMM-yy"); // e.g. 18-Apr-02
    String datestring = sdf.parse(date);
    and use that instead of date in your sql string. Some databases understands it if you do
    "to_date('18-Apr-02')"
    so you could include that in your sql string as well..
    You could also try to make it a java.sql.Date and hope your jdbc driver knows how to convert it to a string that the database understands if you don't know the format:
    con = getConnection();
    PreparedStatement ps = con.prepareStatement("select date1 from table1 where date1 <= ?");
    ps.setDate(new java.sql.Date(date.getTime()));
    ResultSet rs = s.executeQuery(sql);

  • Converting Date Column to format MM/DD/YYYY in RPD

    Hi all,
    I have a requirement like converting a Date column to format MM/DD/YYYY in RPD. Any help as we are not supposed to use the BI Answers Data Fomat for showing this format.
    Thankyou,
    Edited by: [email protected] on May 10, 2010 11:49 PM

    Hi Saichand,
    I need the resulting column in DATE format only. The solution which you specified converts the datatype to character. Is there anyway to convert the format but not the datatype.

  • How to convert the alv list data into pdf format

    Hi Expersts,
                      Is it possible to convert the alv list output data into PDF format? if yes, then please help me with this issue.
    thanks in advance,
    Regards,
    Samad

    hii samad,
    you can go through these link.i hope it ll solve your purpose
    How to convert list output to PDF
    Display ALV list output in PDF format
    regards,
    Shweta

  • How to convert date to system format

    Is there any function module for converting the date in YYYYMMDD format to our own system format. eg. 21.07.2006

    Hi Abinaya,
    Use this func module <b>CONVERSION_EXIT_PDATE_OUTPUT</b>
    Please award points if u find it useful
    Regards,
    Viven

  • Convert date in sql format

    how to convert a date in string format to sql date format?
    thanx in advance

    Use java.text.SimpleDateFormat to parse the String into a java.util.Date.
    Create a java.sql.Date from the java.util.Date.
    Use a PreparedStatement and its setDate() method to set the date in the SQL. The JDBC driver will take care of putting that java.sql.Date object into the correct format for your DB.

  • How to convert from line chart data to CSV format

    Hi ,
    I am using Flex 3 and AS.
    I am getting data from MS SQL and display the data as line
    chart this is ok.
    But i want to convert this line chart data to CSV or .xsl
    format.I find one example in fourms the from data grid to CSV
    For this URL is
    http://www.abdulqabiz.com/blog/archives/flash_and_actionscript/datagriddataexporter.php
    But i want Line chart to CSV.Please help me.

    Line chart is a just a visual representation of some data
    that's sitting in your database. Isn't it? You load this in Flex,
    probably using HTTPService class, and pass it to some chart object.
    Now when use says that she needs it in CSV format, you're
    gonna have to send another request to the server to produce the
    same data, convert into CSV or XLS format and let user download it.
    Of course, if use doesn't want to download, you don't have to
    go to the server, at least for CSV format. You can convert the same
    data that used plot the chart to convert to CSV.
    Am I missing something here?
    ATTA

  • How to convert BLOB data into string format.

    Hi,
    I have problem while converting blob data into string format.
    for example,
    Select dbms_lob.substr(c.shape.Get_wkb(),4000,1) from geotable c
    will get me the first 4000 byte of BLOB .
    When i using SQL as i did above,the max length is 4000, but i can get 32K using plsql as below:
    declare
    my_var CLOB;
    BEGIN
    for x in (Select X from T)
    loop
    my_var:=dbms_lob.substr(x.X,32767,1)
    end loop
    return my_var;
    I comfortably convert 32k BLOB field to string.
    My problem is how to convert blob to varchar having size more than 32K.
    Please help me to resolve this,
    Thanx in advance for the support,
    Nilesh

    Nilesh,
    . . . .The result of get_wkb() will not be human readable (all values are encoded into some binary format).
    SELECT utl_raw.cast_to_varchar2(tbl.geometry.get_wkt()) from FeatureTable tbl;
    -- resulting string:
        ☺AW(⌂özßHAA
    Å\(÷. . . .You may also want to have a look at { dbms_lob | http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14258/d_lob.htm#i1015792 } "The DBMS_LOB package provides subprograms to operate on BLOBs, CLOBs, NCLOBs, BFILEs, and temporary LOBs."
    Regards,
    Noel

  • How to convert internal date to the format of user default setting

    In the BDC program, I need to convert the date, such as the sy-datum 20070427, to the format of user default that is defined in T-code SU01, such as YYYY-MM-DD or YYYY.MM.DD, and so on.
    The user format has 6 six kinds, and it is not good idea to write the code to process. So I look for the functions or CLASS method to process. I can use the function 'ITS_GET_USER_DEFAULTS' to get the user default setting of the Date format and Decimal notation.The problem is that I can not find the function or CLASS method to convert the internal date to user's date format.
    The function: CONVERT_DATE_TO_INTERNAL can not do it.
    The CLASS method: cl_abap_datfm=>conv_date_int_to_ext may be do it. But I do know how exchange the parameters, and fail to make it work finely.
    Is there the functions or CLASS method to process it?
    Thanks a lot!

    Hi John,
    create a veriable :
    data: v_date type char10.
    then after getting the date in YYYYMMDD format, write the following statement.
    WRITE SY-DATUM TO V_DATE.
    this might solve your problem.
    Regards,
    Hemant.

  • MS Excel automatically converts numeric fields to date format

    I have at least 2 different spreadsheets where this happens.  I maintain them for months, adding, changing, deleting data.  They contain lots of data elements (numeric, text, date, etc).   Some columns are all numeric, some all dates,
    etc.  Then suddenly when I open the spreadsheet, my numeric formatted data has been converted to date format.  I see lots of # signs in cells, which is an indication that this happened, and selecting an affected cell shows a date, generally in the
    early 1900s, depending on the original numeric value that was in the cell.  I convert the fields back to numeric, but sometime later the same problem occurs -- numeric fields are now date formatted.  I cannot identfy any specific change that I make
    that would cause this.  And I only recognize it as having occurred when I open the spreadsheet, not anytime during its maintenance.  I am using MS Excel 2007 SP2 in a Windows XP SP3 environment.  The machine is well maintained and updated /
    kept current by our corporate IT group.  I have done numerous Internet searches and cannot find anything like this in any other blog.  Thanks for your help.

    Hi,
    Were some of the these data imported from a .csv file? As far as I know, data formats cannot be saved in .csv file. If this is the situation, try this:
    Save a copy of your .csv file changing the extension of your file from .csv to .txt
    open excel.
    go to DATA --> Import external data --> Import data --> browse to find the .txt file you made earlier
    The text import wizard should open.
    Click on delimited, click next
    click comma, click next
    You should now see all columns appear with heading GENERAL --> highlight the columns with the values that are changing to date and click TEXT (top right) instead. The heading of these columns should now change to TEXT.
    click finish
    Excel will now treat the column as text when it imports the data and will not change them to dates
    If this is not the situation, this issue might be caused by some add-ins.
    Start Excel in safe mode:  Press and hold the
    CTRL key, and then click the Excel program to start. Then, click File > Open to open the Excel file.
    If the problem does not occur in the safe mode, this issue might be related to some third-party add-ins in the Office program, we can try to disable them.
    Best Regards,
    Sally Tang

  • How to convert a date field with format (dd,mm,yyyy) to format (mm,dd,yyyy)

    Hello.
    How to convert a date field with format (dd,mm,yyyy) to format (mm,dd,yyyy)
    I have text field which has a databind to a date field. When I click on it, we can select the date, it is added on the format (dd,mm,yyyy). When I want to insert this date field to a database It doesnu2019t allow me to do it because it will only accept date field on the format (mm,dd,yyyy)
    I tried to store this format on a date variable and I get a message saying that is impossible to convert a string into a date.
    Regards,
    Jose

    Hi Jose,
    usually you format strings in c# like
    string.Format("{0:yyyyMMdd}", insertyourstring);
    in your case
    string.Format("{0:MM/dd/yyyy}", insertyourstring);
    [look here|http://idunno.org/archive/2004/14/01/122.aspx]
    there are more details
    if everything fails split the string with Mid()
    or ask me
    lg David

  • How to convert date from ccyymm format to mmddyy

    hi,
    How to convert date from ccyymm format to mmddyy

    Please don't multipost. This question has been answered in your first post.
    How to convert date to ccyymm format
    Regards,
    Jo

  • How to convert date to ccyymm format

    Hi,
    How to convert date to ccyymm format.
    Thanks

    dadivela wrote:
    Re: How to convert date from ccyymm format to mmddyyI didn't inderstand. Date doesn't have any format. If you have a string in CCYYMM format, you would have to extract the YYMM from the string.
    SQL> SELECT   SYSDATE,
      2           TO_CHAR (SYSDATE, 'ccyymm') Date_Fm,
      3           SUBSTR (TO_CHAR (SYSDATE, 'ccyymm'), 3) YYMM
      4    FROM   DUAL
      5  /
    SYSDATE   DATE_F YYMM
    08-JUN-09 210906 0906You can use this string to convert it to date. Note that since DD part of your date was not their in the resultan string, the converted date will fall back to first of the month specified.
    SQL> SELECT   SYSDATE,
      2           TO_CHAR (SYSDATE, 'ccyymm') Date_Fm,
      3           SUBSTR (TO_CHAR (SYSDATE, 'ccyymm'), 3) YYMM,
      4           TO_DATE (SUBSTR (TO_CHAR (SYSDATE, 'ccyymm'), 3), 'YYMM') conv_Dat
    e
      5    FROM   DUAL
      6  /
    SYSDATE   DATE_F YYMM             CONV_DATE
    08-JUN-09 210906 0906             01-JUN-09
    SQL>Then convert the date into the required format using TO_CHAR Function
    SQL> SELECT   SYSDATE,
      2           TO_CHAR (SYSDATE, 'ccyymm') Date_Fm,
      3           SUBSTR (TO_CHAR (SYSDATE, 'ccyymm'), 3) YYMM,
      4           TO_DATE (SUBSTR (TO_CHAR (SYSDATE, 'ccyymm'), 3),
      5                   'YYMM') conv_Date,
      6           TO_CHAR(TO_DATE(SUBSTR(TO_CHAR (SYSDATE, 'ccyymm'),3),
      7                   'YYMM'), 'MMDDYY') New_Format
      8    FROM   DUAL
      9  /
    SYSDATE   DATE_F YYMM             CONV_DATE NEW_FO
    08-JUN-09 210906 0906             01-JUN-09 060109
    SQL>Hope this helps.
    Regarads,
    Jo

Maybe you are looking for