Convert Date in dd-MM-yy format

I am taking parameter as date in front end and I am comparing it with database through view object through executeParams. But both the date formats are different, that's why I can't compare both formats. Please suggest me to compare both formats in dd-MM-yy format. I am taking parameter by inputDate component.

Hi,
Use this code inside your where clause
apply_date=to_date('"+getdate()+"','rrrr-mm-dd')in the 'apply_date' write your table column name which you want to compare.
getDate() is date type 'value binding' of InputDate component.
RAFAT

Similar Messages

  • 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.

  • FM to convert Date Entered to a standard format

    Hello All,
    Is there any FM to convert the date entered (in the format given in SU01) to a standard format
    (Eg: DD.MM.YYYY).  Is there any FM that does the reverse of it.
    Please help us out with your suggesstions.
    Thanks,
    Seetharaman V

    Hi seetharaman,
    please refer the following link for using the conversion exit for date in BSP application.
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/72d7ac11-0501-0010-63a2-cc6960569926
    hpe this ll help.
    thnks.

  • Converting dat/timestamp field into desired format

    Hi all
    How do I convert sysdate or current_timestamp to the following format?
    August 26, 2002 11:44:00 AM PDT
    I am struggling mainly with the timezone portion (PDT) etc.
    Would appreciate any help - Thanx!:)
    Regards
    Menon:)

    You won't be able to add the timezone to the date format itself. You'll rather have to tack on the literal string to the end of the date string.
    select to_char(sysdate,'fmMonth dd, yyyy hh:mi:ss AM')||' PDT' from dual;
    Armand

  • Convert date in BST to GMT format

    Here date and cal.getTime() return date in BST format. But my requirement is date should be converted to GMT format and then compared with cal.getTime() which is in BST format.
              Object o = timeStamp.get(TIMESTAMP_OBJECT);
                java.util.Date date = (java.util.Date) o;
                Calendar cal = Calendar.getInstance();
                getBDO().setLastDespatch(isLastDespatch(cal.getTime(), date));
    public static boolean isLastDespatch(Date counterDate, Date lastDespatchDate)
            if (counterDate.before(lastDespatchDate))
                // last despatch timestamp before
                return false;
            else
                // last despatch timestamp expired, therefore tell clerk
                return true;
        }I tried
    Object g = date.toGMTString();
    But I am not able to convert this object to again Date...

    NewComer_forum wrote:
    I tried with below code but throwing exceptions
    String g = date.toGMTString();
    SimpleDateFormat date1 = new SimpleDateFormat(g);
    You of course read the Javadoc, and so know that the argument to the constructor SimpleDateFormat(String) is the pattern by which you want to parse, and not the string you want to parse itself, right? I mean, you didn't just try one random thing to prove that you gave it a minimal effort before coming back here for more handholding, correct?
    Do me a favour and try my suggestion before continuing. I don't know for sure that it will work, but I think it's likely.

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

  • How to convert date format to MM/DD/YYYY

    Hi,
       How to convert date format to MM/DD/YYYY.
    Thanks,
    Senthil

    hi,
    tri with this function module
    data :l_date(10) type c
    CALL FUNCTION 'CONVERT_DATE_TO_EXTERNAL'
    EXPORTING
       DATE_INTERNAL                  = SY-DATUM
    IMPORTING
       DATE_EXTERNAL                  = l_date.
    this function module converts date from 20050601 to external format  which is specified in user profile
    cheers,
    sasi

  • Convert date from YYYYMMDD to DDMMYYYY

    Please help if anyone knows any function module to convert date from YYYYMMDD to DDMMYYYY format..
    Thanks in Advance,
    manjari

    Hello.
    Simply do like this:
    DATA: datum TYPE char10.
    WRITE sy-datum TO datum <format option>.
    <format options>:
    DD/MM/YY and MM/DD/YY:
    Both additions have the same effect. The date output has a two-digit year value and a separator. The separator and the order are taken from the definition for date output in the user master record.
    DD/MM/YYYY und MM/DD/YYYY:
    Both additions have the same effect. The date output has a four-digit year value and separator. The separator and the order are taken from the definition for date output in the user master record.
    DDMMYY und MMDDYY:
    Both additions have the same effect. The date output has a two-digit year value and no separator. The order is taken from the definition for date output in the user master record.
    YYMMDD:
    This addition provides a date output with a two-digit year value without a separator in the format YYMMDD.
    Regards.
    Valter Oliveira.

  • Need to convert  Date from calendar to String in the format dd-mom-yyyy

    Need to convert Date from calendar to String in the format dd-mom-yyyy+..
    This is absolutely necessary... any help plz..
    Rgds
    Arwinder

    Look up the SimpleDateFormat class: http://java.sun.com/j2se/1.4.2/docs/api/java/text/SimpleDateFormat.html
    Arwinder wrote:
    This is absolutely necessary... any help plz..For you maybe, not others. Please refrain from trying to urge others to answer your queries. They'll do it at their own pace ( if at all ).
    People on the forum help others voluntarily, it's not their job.
    Help them help you.
    Learn how to ask questions first: http://faq.javaranch.com/java/HowToAskQuestionsOnJavaRanch
    (Yes I know it's on JavaRanch but I think it applies everywhere)
    ----------------------------------------------------------------

  • How to convert date format(mm/dd/yy) into dd-mm-yy

    I want to convert date format(mm/dd/yy) into dd-mm-yy
    like 12/23/06 into 23-sep-06

    hey, you can use SimpleDateFormat to format your date. this is sample code, maybe could help you.
    class dateFormat
         public static void main(String[] args)
              Date now = new Date();
              System.out.println("Before format : "+now);
              SimpleDateFormat sdf = new SimpleDateFormat( "dd-MM-yy" );//Change your date format in here.
              String display = sdf.format(now);
              System.out.println("After format : "+display);
    }If you already understand about my sample code, i think it's easy to make your own date format. Just modified few line of my code.

  • How to convert date format dd.mm.yy into yyyymmdd?

    Hello experts,
    how to convert date format dd.mm.yy into yyyymmdd?
    Thanx
    Axel

    Hi
    go through these previous threads on similar question
    https://forums.sdn.sap.com/click.jspa?searchID=673529&messageID=1763194
    Date Conversion in Flat File
    converting the DATE(yyyymmdd) into MONTH(yyyymm) format
    Date Format Conversion from MM.DD.YYYY to YYYYMMDD
    gives clear idea
    Reagrds
    Kiran
    Message was edited by:
            ravi kiran naalla

  • How to convert Date in varchar(50) format MM/DD/YYYY HH:MM into YYYY-MM-DD format using MS SQLServer 2008 R2 ?

    Hi,
    I am getting the error "The conversion of a varchar data type to a datetime data type resulted in an out-of-range value."
    when converting date in format Date in varchar(50) format MM/DD/YYYY HH:MM into YYYY-MM-DD format using MS SQLServer 2008 R2.
    Please note that the date in column is Date(varchar(50), null).
    I used the following syntax:
    SELECT  CONVERT(VARCHAR(10), Date, 102) AS Day
    FROM   dbo.[RCap_2G MM/Operator]
    WHERE  (CONVERT(VARCHAR(10), Date, 102) > { fn NOW() } - 1)

    As noted above, either use ISDATE or TRY_CONVERT with the correct conversion style number:
    -- SQL Server 2012 code
    DECLARE @Date varchar(50) = '10/23/2006 10:20';
    SELECT TRY_CONVERT(DATE, @Date, 101) AS Day
    -- 2006-10-23
    Datetime conversion blog:
    http://www.sqlusa.com/bestpractices/datetimeconversion/
    Kalman Toth Database & OLAP Architect
    SQL Server 2014 Design & Programming
    New Book / Kindle: Exam 70-461 Bootcamp: Querying Microsoft SQL Server 2012

  • How to convert date from "yyyymmdd" to "MM/DD/YYYY" format

    1. I have one BLDAT field in my internal table.
       its getting updated from input file.
    2. The value in the input file is like yyyymmdd.
       So the internal table field is filled like this
       "YYYYMMDD".
    3. After this,I have to compare this internal table  
       field with BSAD table.
    4. The BLDAT field in BSAD table is in the format of 
       "MM/DD/YYYY".
    5. the BLDAT field is having diff format in internal  table and BSAD table.So I am unable to check this value.
    How to convert it as like the BSAD table format."MM/DD/YYYY" format.
    Thanks in advance!!

    Using the WRITE statement
      data: gd_date(10).  "field to store output date
    * Converts date from 20020901 to 09.01.2002
      write sy-datum to gd_date mm/dd/yyyy.
    OR u can
    CONCATENATE gd_date+4(2) gd_date+6(2) gd_date+0(4)
    into gd_date seperated by '/' .
    Hope this helps.
    Kindly reward points and close the thread for the
    answer which helped u OR get back with queries.

  • To convert date dd/mm/yyyy in Timestamp format

    hi
    I want to convert date of format dd/MM/yyyy, which get from user by PropertyUtils.getSimplePropetrty(form, "startDate"); , into Timestamp format...........
    please help me in this regard.......
    1904

    ya mean it from java.sql.Timestamp
    and also I am using getTime() method but giving
    root cause:
    org.apache.commons.beanutils.ConversionException: Timestamp format must be yyyy-mm-dd hh:mm:ss.fffffffff
    and
    Caused by: java.lang.IllegalArgumentException: Timestamp format must be yyyy-mm-dd hh:mm:ss.fffffffff
    at java.sql.Timestamp.valueOf(Timestamp.java:160)
    at org.apache.commons.beanutils.converters.SqlTimestampConverter.convert(SqlTimestampConverter.java:157)

  • 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.

Maybe you are looking for