<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: converting the date in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/converting-the-date/m-p/4628301#M1090106</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can convert any kind of date by using the OFFSET&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For example &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;YYYY/MM/DD&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;DATA :
    w_d1 TYPE sy-datum VALUE '2008/10/15'.
   w_str  TYPE string.
   w_dot TYPE c VALUE'.'.

 CONCATENATE w_d1+6(2) w_dot w_d1+4(2)  w_dot w_d1+0(4) INTO w_str.

WRITE:
    w_str.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Output will be &lt;/P&gt;&lt;P&gt;     15.10.2008&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Pavan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 15 Oct 2008 12:53:37 GMT</pubDate>
    <dc:creator>bpawanchand</dc:creator>
    <dc:date>2008-10-15T12:53:37Z</dc:date>
    <item>
      <title>converting the date</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/converting-the-date/m-p/4628299#M1090104</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;i need to convert the date from the following formats&lt;/P&gt;&lt;P&gt;  1. MM/DD/YYYY&lt;/P&gt;&lt;P&gt;  2. MM-DD-YYYY&lt;/P&gt;&lt;P&gt;  3. YYYY/MM/DD&lt;/P&gt;&lt;P&gt;  4. YYYY-MM-DD&lt;/P&gt;&lt;P&gt;  5. DD.MM.YYYY&lt;/P&gt;&lt;P&gt;  6. YYYY.MM.DD&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; to  MM.DD.YYYY FORMAT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;THANKS AND REGARDS&lt;/P&gt;&lt;P&gt;PRIYA&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Oct 2008 12:46:58 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/converting-the-date/m-p/4628299#M1090104</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-10-15T12:46:58Z</dc:date>
    </item>
    <item>
      <title>Re: converting the date</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/converting-the-date/m-p/4628300#M1090105</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;imagine 20080908 is sy-datum&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data : date(10) type c.&lt;/P&gt;&lt;P&gt;date&lt;EM&gt;0(2) = sy-datum&lt;/EM&gt;4(2). move '09' first&lt;/P&gt;&lt;P&gt;date+2(1) = '.'. &lt;/P&gt;&lt;P&gt;date&lt;EM&gt;3(2) = sy-datum&lt;/EM&gt;6(2). move '08' &lt;/P&gt;&lt;P&gt;date+5(1) = '.'.&lt;/P&gt;&lt;P&gt;date&lt;EM&gt;6(4) = sy-datum&lt;/EM&gt;0(4). move '2008' &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Neenu&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Oct 2008 12:51:53 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/converting-the-date/m-p/4628300#M1090105</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-10-15T12:51:53Z</dc:date>
    </item>
    <item>
      <title>Re: converting the date</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/converting-the-date/m-p/4628301#M1090106</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can convert any kind of date by using the OFFSET&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For example &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;YYYY/MM/DD&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;DATA :
    w_d1 TYPE sy-datum VALUE '2008/10/15'.
   w_str  TYPE string.
   w_dot TYPE c VALUE'.'.

 CONCATENATE w_d1+6(2) w_dot w_d1+4(2)  w_dot w_d1+0(4) INTO w_str.

WRITE:
    w_str.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Output will be &lt;/P&gt;&lt;P&gt;     15.10.2008&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Pavan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Oct 2008 12:53:37 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/converting-the-date/m-p/4628301#M1090106</guid>
      <dc:creator>bpawanchand</dc:creator>
      <dc:date>2008-10-15T12:53:37Z</dc:date>
    </item>
    <item>
      <title>Re: converting the date</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/converting-the-date/m-p/4628302#M1090107</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Check the code below.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;For getting date format in the form like 10.Dec.2008&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;WHEN '01'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CALL FUNCTION 'CONVERSION_EXIT_SDATE_OUTPUT'&lt;/P&gt;&lt;P&gt;EXPORTING&lt;/P&gt;&lt;P&gt;input = date2&lt;/P&gt;&lt;P&gt;IMPORTING&lt;/P&gt;&lt;P&gt;output = date_format.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IF sy-subrc EQ 0.&lt;/P&gt;&lt;P&gt;date_format1 = date_format.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;For getting date in the format like 10.December.2008&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;WHEN '02'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CALL FUNCTION 'CONVERSION_EXIT_SDATE_OUTPUT'&lt;/P&gt;&lt;P&gt;EXPORTING&lt;/P&gt;&lt;P&gt;input = date2&lt;/P&gt;&lt;P&gt;IMPORTING&lt;/P&gt;&lt;P&gt;output = date_format.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IF sy-subrc EQ 0.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Get Month Long text &lt;/P&gt;&lt;P&gt;SELECT SINGLE ltx&lt;/P&gt;&lt;P&gt;FROM t247 INTO ws_month&lt;/P&gt;&lt;P&gt;WHERE ktx EQ date_format+3(3)&lt;/P&gt;&lt;P&gt;AND spras EQ 'E'.&lt;/P&gt;&lt;P&gt;IF sy-subrc EQ 0.&lt;/P&gt;&lt;P&gt;CONCATENATE date_format&lt;EM&gt;0(2) ws_month date_format&lt;/EM&gt;7(4) INTO date_format1 SEPARATED BY space.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks &amp;amp; Regards,&lt;/P&gt;&lt;P&gt;Naresh&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Oct 2008 12:53:43 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/converting-the-date/m-p/4628302#M1090107</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-10-15T12:53:43Z</dc:date>
    </item>
    <item>
      <title>Re: converting the date</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/converting-the-date/m-p/4628303#M1090108</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Do you need a FM for these?&lt;/P&gt;&lt;P&gt;I think you can do it with code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. w_date = MM/DD/YYYY&lt;/P&gt;&lt;P&gt;Code : Replace all occurences of '/' in w_date with '.'.&lt;/P&gt;&lt;P&gt;O/p : MM.DD.YYYY.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2. w_date = MM-DD-YYYY&lt;/P&gt;&lt;P&gt;Code : Replace all occurences of '-' in w_date with '.'.&lt;/P&gt;&lt;P&gt;O/p : MM.DD.YYYY.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;3. w_date = YYYY/MM/DD or YYYY-MM-DD or YYYY.MM.DD&lt;/P&gt;&lt;P&gt;Code : Data w_date1(10) type c,&lt;/P&gt;&lt;P&gt;Concatenate w_date&lt;EM&gt;6(2) '.' w_date&lt;/EM&gt;4(2) '.' w_date+0(4) into w_date1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;4. w_date = DD.MM.YYYY&lt;/P&gt;&lt;P&gt;Code : w_inter(2) type c.&lt;/P&gt;&lt;P&gt;w_inter = w_date+0(2).&lt;/P&gt;&lt;P&gt;w_date&lt;EM&gt;0(2) = w_date&lt;/EM&gt;3(2).&lt;/P&gt;&lt;P&gt;w_date+3(2) = w_inter.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Pramod&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Oct 2008 12:57:38 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/converting-the-date/m-p/4628303#M1090108</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-10-15T12:57:38Z</dc:date>
    </item>
    <item>
      <title>Re: converting the date</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/converting-the-date/m-p/4628304#M1090109</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&amp;gt; &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;gt; i need to convert the date from the following formats&lt;/P&gt;&lt;P&gt;&amp;gt;   1. MM/DD/YYYY&lt;/P&gt;&lt;P&gt;&amp;gt;   2. MM-DD-YYYY&lt;/P&gt;&lt;P&gt;&amp;gt;   3. YYYY/MM/DD&lt;/P&gt;&lt;P&gt;&amp;gt;   4. YYYY-MM-DD&lt;/P&gt;&lt;P&gt;&amp;gt;   5. DD.MM.YYYY&lt;/P&gt;&lt;P&gt;&amp;gt;   6. YYYY.MM.DD&lt;/P&gt;&lt;P&gt;&amp;gt; &lt;/P&gt;&lt;P&gt;&amp;gt;  to  MM.DD.YYYY FORMAT.&lt;/P&gt;&lt;P&gt;&amp;gt; &lt;/P&gt;&lt;P&gt;&amp;gt; THANKS AND REGARDS&lt;/P&gt;&lt;P&gt;&amp;gt; PRIYA&lt;/P&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I don't know of any standard SAP functions that can handle this kind of date conversion. So, i guess you have to write it yourself.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Personally my approach would be this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. check if the date holds which separator.&lt;/P&gt;&lt;P&gt;2. split the date at the separator into an internal table.&lt;/P&gt;&lt;P&gt;3. thus your internal table will always have 3 lines: DD, MM and YYYY&lt;/P&gt;&lt;P&gt;4. loop at the internal table to determine &lt;/P&gt;&lt;P&gt;4a. which line holds the year: the length of the value in that line is always 4.&lt;/P&gt;&lt;P&gt;4b. which line holds the month: month can never exceed the value of 12.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The only problem i see is that 12/04/2008 (4 december 2008) and 12.04.2008 (12 april 2008) are not the same (based on your definition).&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Oct 2008 12:57:59 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/converting-the-date/m-p/4628304#M1090109</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-10-15T12:57:59Z</dc:date>
    </item>
    <item>
      <title>Re: converting the date</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/converting-the-date/m-p/4628305#M1090110</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi ,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  Try using the following function module&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  HR_IN_GET_DATE_COMPONENTS&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  if you pass date(in any formate) you will get day, month and year.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; using 'concatenate' key word get the required formate.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Jaya Vani.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Oct 2008 13:00:19 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/converting-the-date/m-p/4628305#M1090110</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-10-15T13:00:19Z</dc:date>
    </item>
  </channel>
</rss>

