Convert yyyymmdd date format to mm/dd/yyyy

hi,
I convert the date fomat in my program from yyyymmdd to dd/mm/yyyy format using this code:
WRITE it_pos-bldat TO i_outpos-bldat MM/DD/YYYY.
I declared the bldat field by: bldat(10) TYPE c so that the field will contain the '/' character.
The output of my program is in alv format and the problem is when I sort the bldat field, it will be sorted as a character field and not by date.
Ex. 01/06/2005
    02/23/2004
    03/12/2006
    04/09/2004
It should be sorted like this:
02/23/2004
04/09/2004
01/06/2005
03/12/2006
Please let me know how I can convert into mm/dd/yyyy format and can still be sorted in the alv by date.
Thanks!
Eric

<b>HRGPBS_HESA_DATE_FORMAT</b>
Format a date valid for HESA: DD/MM/YYYY
data:date_form type CHAR10.
call function 'HRGPBS_HESA_DATE_FORMAT'
exporting
P_DATE = sy-datum
importing
DATESTRING = date_form
exceptions
others = 1.
write : date_form.
also check thread..
Re: Regarding Date conversion

Similar Messages

  • Is there any function module to convert the date format

    Dear ABAPers,
    Is there any function module to convert the date format from dd.mm.yyyy to dd-mmm-yyyy.
           I want to convert the date format from dd.mm.yyy to dd.mmm.yyy Eg.from 10.03.2008 to 10-mar-2009.
    Thanks & Regards,
    Ashok.

    hi,
    create custom function module or copy the below code in the report ..and use it
    the out put for below is :----Convert a DATE field into a full format date eg. March 23, 2000
    FUNCTION Z_CONVERT_DATE_INTO_FULL_DATE.
    ""Local interface:
    *"       IMPORTING
    *"             VALUE(DATE) LIKE  SY-DATUM
    *"       EXPORTING
    *"             VALUE(FORMATTED_DATE)
    *"       EXCEPTIONS
    *"              INVALID_DATE
    TABLES: TTDTG.
    DATA: BEGIN OF T_DATE,
            YYYY(4) TYPE C,
            MM(2) TYPE C,
            DD(2) TYPE C,
          END OF T_DATE.
    DATA: DAY(3) TYPE N.
    DATA: VARNAME LIKE TTDTG-VARNAME.
    IF DATE IS INITIAL.
      CLEAR FORMATTED_DATE.
      EXIT.
    ENDIF.
    check document date format
    CALL FUNCTION 'DATE_CHECK_PLAUSIBILITY'
      EXPORTING
        DATE = DATE
      EXCEPTIONS
        PLAUSIBILITY_CHECK_FAILED = 1.
    IF SY-SUBRC NE 0.
      RAISE INVALID_DATE.
    ENDIF.
    MOVE DATE TO T_DATE.
    CONCATENATE '%%SAPSCRIPT_MMM_' T_DATE-MM INTO VARNAME.
    SELECT SINGLE * FROM TTDTG WHERE SPRAS = 'EN' AND VARNAME = VARNAME.
    WRITE T_DATE-DD TO DAY.
    CONCATENATE DAY ',' INTO DAY.
    CONCATENATE TTDTG-VARVALUE DAY T_DATE-YYYY INTO FORMATTED_DATE
      SEPARATED BY SPACE.
    ENDFUNCTION.
    the output is :--Convert a DATE field into a full format date eg. March 23, 2000
    Regards,
    Prabhudas

  • Convert the date of string to datetime format 'MM/dd/yyyy' when the system date format is 'dd/MM/yyyy'.

    I need convert the date of string format 'MM/dd/yyyy' to datetime format 'MM/dd/yyyy' when the system date format is 'dd/MM/yyyy'.Since
    I need to search values based on date where my database datetime  is 'MM/dd/yyyy' format.

    In my opinion you should re-consider the assumption that the date picker returns a string. Maybe it is able to return a
    DateTime object directly instead of string. Then you will pass this value as a parameter of SQL query. This should work regardless of computer configuration.
    Otherwise, follow the previous string-based approaches.

  • 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 Oracle date format masks to Java format masks

    Have an application based on Oracle that stores data in text form (for display) and in native date format. It is being migrated to another application with a Java based front end that can only use Java format masks to display the dates in the desired display format.
    Is there a way to translate the Oracle format masks to Java? I can do this in SQL or PL/SQL using the database or in Java.
    I really don't want to write detailed code to parse the masks, although if parsers are available to take an oracle mask into its metadata (minute, year, etc), it may be possible for me to write the code.
    This seems like something that must have been done many times over the years. I would prefer to reuse workable code rather than reinventing the wheel.
    To be clear, I do not need to alter data or convert dates shown in string form. Just the format masks so the new app will display dates in the same manner as the old app. Fortunately, both apps handle interpreting the format masks in their native technology, so it is just converting the format mask.

    kenmadsen wrote:
    Both applications have a varchar2 column and a date column. A date picker selects and returns the date in native format for storage and the application uses the mask to format the varchar2 column for display (and storage). The old application uses an Oracle date format mask DD-Mon-YYYY HH24:MI and the new application uses Java date masks (DD-MM-YYYY hh:mm). (I may not have the translation from HH24 to hh correct).
    The date column and the display column store the same information (a date), but one is stored natively and the other is displayed as the application administrator want the particular row to be formatted for display. (the mask is a column in the same table as the other 2 columns). Each row has characteristics (other columns) that determines what the data is and how it should be shown (some things need to show time; others only the date)
    So the problem is, when migrating, the new application cannot render the dates as the old app did because "Mon" is Oracle format, not Java format.
    No data is being converted in the migration, except for the mask itself. Both applications have the same record structure with respect to these columns and they both use the mask to generate the formatted varchar2 data for display in the application and storage.too bad you insist on try to describe with words rather than actual CODE.
    Please explain again why this is an Oracle problem & NOT a Java problem?
    Oracle RDBMS is a data repository & can't automagically change data content for you.

  • How can I change defaut date format to dd-mon-yyyy in bi analytics

    hi..
    How can I change the default date format to DD-MON-YYYY in BI Analytics...
    I am passing a date in a report from a prompt....but it is always taking "dd-mon-yyyy hh:mm:ss" format...I want to input the prompt in oracle's default date format i.e dd-mon-yyyy..
    please help...I dont want to use cast function because it will convert the date into a character value....I want a date...

    Hi USer
    Try this link
    How to change date format in OBIEE
    Re: repository variable at date prompt
    Thanks
    Diney

  • Function module to get any date format in DD.MM.YYYY

    Hi  Experts,
    i want a FM which can convert any type of date format user entered on selection screen in DD.MM.YYYY
    date format entered by user  can be any of below format
    DD/MM/YYYY
    MM/DD/YYYYY
    DD/MMM/YYYY
    MM.DD.YYYY
    YYYY/MM/DD
    i want date format in DD.MM.YYYY
    Also is there any FM  which can tell  us that  day of today date is  25th or  not .

    Read forum rules of engagement before posting.
    Basic date posts are not permitted.

  • How to convert any date format to default US format using javascript???

    Hi,
    I was trying to convert a date format to default US date format. The date format will vary according to different regions (It can be dd/MM/yyyy or MM/dd/yyyy or yyyy/dd/MM or any). I need to convert it in to MM/dd/yyyy always (US Format). Please give some
    solutions for the same.
    Warm Regards,
    Tony Joy

    hi
    it is not trivial task in common case. We faced with similar issue when tried to localize date times in display templates in Sharepoint 2013 depending on site's locale, which can be done only via javascript. In order to do it you need to add date time locale
    information from server side to client side, e.g. by defining global variable. See the following article for details:
    Localize datetimes in display templates in Content by search web parts in Sharepoint 2013. I extended OTB global object _spPageContextInfo with new property (as far as I remember this object is also available in Sharepoint 2010):
    <script type="text/javascript">
    jQuery(function() {
    if (typeof (_spPageContextInfo) != "undefined" &&
    _spPageContextInfo != null) {
    <%
    var ci = new CultureInfo(1033);
    var cultureSerialized = new JavaScriptSerializer().Serialize(
    new
    name = ci.Name,
    dateTimeFormat = ci.DateTimeFormat,
    numberFormat = ci.NumberFormat
    %>
    _spPageContextInfo.currentCultureSerialized = <%= cultureSerialized %>;
    </script>
    Having different date time formats for your locale, you may use
    Date.localeFormat function from MS Ajax for formatting the date in specific format. If in your case format is predefined you may hardcode it without adding DateTime formats from server side.
    Blog - http://sadomovalex.blogspot.com
    Dynamic CAML queries via C# - http://camlex.codeplex.com

  • Re:How to pick the date format as dd/MM/yyyy from the database

    Hi all,
    I am using JDev 11.1.2.3.0
    My requirement is ,i want to pick the date from the database as dd/MM/yyyy format.I set the attribute as
    r1.setAttribute("JobDescription",
    "From" + olrow.getAttribute("PeriodFrom") + "To" + olrow.getAttribute("PeriodTo")
    here periodFrom and periodTo are the date attributes.i set periodFrom and periodTo date format as dd/mm/yyyy in the VO.on UI page it is showing dd/mm/yyyy format.but it is storing in the database as yyyy/mm/dd format.Here my problem is when i set periodFrom and periodTo values to the JobDescription,the JobDescription format is showing yyy/mm/dd format.here i want to show the JobDescription also dd/mm/yyyy format on the UI page.here JobDescriptin type is string.can anyone help me out please...
    Thanks,
    G.Shilpa

    Hi,
    you can use SimpleDateFormat to parse Date objects to formatted Strings
    SimpleDateFormat (Java Platform SE 7 )
    Note that dependent in your Date type you may deal with Date or SQL Date in ADF BC. SqlDate woild need to be converted to Date first and then parsed into a formatted String. I suggest you Google for SimpleDateFormat examples
    Frank

  • How to convert "any" date format to internal format

    Hi,
    I want to convert any date format  to internal format. Is there any function module ?
    The date formats could be:
    DD.MM.YYYY
    MM/DD/YYYY
    MM-DD-YYYY
    YYYY.MM.DD
    YYYY/MM/DD
    YYYY-MM-DD
    Thank you,
    Surya

    Hi,
    Check this sample program..It will convert sap supported external format to the internal format..
    PARAMETERS: v_char(10).
    DATA: v_date TYPE sydatum.
    DATA: v_period TYPE usr01-datfm.
    Get the format.
    DD.MM.YYYY
    IF v_char+2(1) = '.'.
    CONCATENATE v_char6(4) v_char3(2) v_char(2) INTO v_date.
    ENDIF.
    MM/DD/YYYY
    IF v_char+2(1) = '/'.
    CONCATENATE v_char6(4) v_char(2) v_char3(2) INTO v_date.
    ENDIF.
    MM-DD-YYYY
    IF v_char+2(1) = '-'.
    CONCATENATE v_char6(4) v_char(2) v_char3(2) INTO v_date.
    ENDIF.
    YYYY.MM.DD
    IF v_char+4(1) = '.'.
    CONCATENATE v_char(4) v_char5(2) v_char8(2)  INTO v_date.
    ENDIF.
    YYYY/MM/DD
    IF v_char+4(1) = '/'.
    CONCATENATE v_char(4) v_char5(2) v_char8(2)  INTO v_date.
    ENDIF.
    YYYY-MM-DD
    IF v_char+4(1) = '-'.
    CONCATENATE v_char(4) v_char5(2) v_char8(2)  INTO v_date.
    ENDIF.
    WRITE: / v_date.
    Thanks,
    Naren

  • How To Convert Incomming Date Format  to Our Own Format

    Hi All,
    My Sceario is File XI-File
    My Incoming File is Having the Date With Some DD.MM.YYYY
    But I Want to Convert that Date Format to YYYY MM DD
    So What i have to Do For this
    Regards
    Vamsi

    Hi u can create USD define function
    sample code
    String DB;
    DB=DOB.substring(8,10)"/"DOB.substring(5,7)"/"DOB.substring(1,4);
    return DB;
    or else u can use DateTrans from ur standard function.
    right click -> properties -> give the date format
    regards
    yugapreetha
    Message was edited by:
            Yugapreetha T

  • Problem in converting legacy date format

    Hello all,
    I am having a legacy file in which the date format is yyddd (  e.g  07129 ).
    Can any of you experts suggest me how can i convert these date format in SAP date format i.e YYYYMMDD.
    Please  suggest.
    Arun

    Hi, Arun
    May be the following code will help you in this way,
    data: date like sy-datum,
          year(4),
          month(2),
          day(2).
    year = '2006'.
    month = '12'.
    day = '01'.
    date+0(4) = year.
    date+4(2) = month.
    date+6(2) = day.
    Replay if any problem,
    Kind Regards,
    Faisal
    Edited by: Faisal Altaf on Jan 6, 2009 11:00 PM

  • How do I get the date format of MM/DD/YYYY to be recognized in Numbers?

    I recently switched from Windows and Excel.  All the bank details that I export from my bank have dates formatted as mm/dd/yyyy.  Excel has no issues dealing with this but Numbers will not recognize the cell contents as a date.  Any help?

    I have similar problems with data copied & pasted from a banking web page into Numbers. I always first check to see that the cells are formatted as date & time, but that doesn't always fix the problem. The problem usually ends up being spaces before and/or after the numbers in a cell.

  • How to change data format from  MM/DD/YYYY to DD/MM/YYYY

    HI,
    How can we change data format from MM/DD/YYYY to DD/MM/YYYY in Prompt and Report Level in obiee 11g.
    Please help me ont this.
    Thanks

    Hi,
    In Prompt:
    Try using EVALUATE function.
    Eg: Evaluate('TO_CHAR(%1,%2)' as character(30),"D5.Times"."Day Date",'DD-MON-YYYY')
    Report level:
    Try this in the column formula-
    Evaluate('TO_CHAR(%1,%2)' as character(30),"D5.Times"."Day Date",'MM/DD/YYYY')
    (or)
    EVALUATE('TO_CHAR(%1,%2)' AS CHARACTER ( 30 ), "Dim- Date".Start Date, 'MON-YY')
    http://108obiee.blogspot.in/2009/03/how-to-change-date-format-mask-in-date.html
    http://obiee-bip.blogspot.in/2011/08/customizing-obiee-calendar-display.html
    Some other methods.
    Metdhod 1:
    'Save System-Wide Column Formats' Option
    Check this.
    http://siebel-essentials.blogspot.com/2010/10/11-obiee-11g-tips-9-system-wide.html?m=1
    Thanks
    satya

  • How to keep date format as dd/mm/yyyy in Agentry independent of backend value format?

    I am using Agentry 6.0.38.1 android client and 6.0.32 plugin.
    I want to keep date format as dd/mm/yyyy in Agentry independent of backend value date format.
    How can I do it?
    Regards
    -Prit

    Jason/Sravanthi
    When I log in with 6.0.38.1 android client, I get date format in dd/mm/yyyy independent of device date format (I checked by changing device date format) and when I log in with 6.0.30.x android client, I get date format in mm/dd/yyyy independent of device date format for the same export to same connection.
    Don't know why this is happening.
    Sravanthi,
    The solution you suggested didnt work
    Regards
    Prit

Maybe you are looking for

  • Querying a date field with different masks in form and database

    Dear friends, I have a field with date format mask dd/mm/yyyy hh24:mi:ss, but the same field has date format dd/mm/yyyy inside the form which queries it. If I run this form, obviously I will query this date in dd/mm/yyyy format mask, but this date is

  • Pass package variable to script logic

    Hi expert, I have creted a variable in a Package with the statement PROMPT(TEXT,%PERCE%,"Revaluation rate",,"") the variable appears and properly stores a value. However, what statement can be used to pass it to the sript logic? I tried 'TASK(Execute

  • Mx:tree not updating dynamically

    Hi I am trying to simulate a directory structure through a tree representation. I use a cfdirectory call through a RemoteObject and attach the result to an XML object which then becomes the tree dataprovider. The first time the tree opens fine with a

  • Speeding up Boot Times

    Hey Guys, Just installed my first copy of Arch on my machine. I am loving it so far, especially Pacman, however I would like to see about speeding up the boot time of the machine. This is sort of a generic question but what tips/tricks do you have to

  • Compress command, can I change the destination for the ".zip" file?

    I cannot find a "User's Manual" for my OS 10.5.8. Hence my question. I have used up all but 1% of my hard disc space. Now I wish to compress and backup my iPhoto files (44Gb) specifying (?sp) my backup drive as the destination for the compressed file