<?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: Date conversion in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/date-conversion/m-p/1074170#M95771</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try this.  I believe that this function module works from the user defaults, meaning that it will except the date as it is formatted by the user defaults.  In my system,  my default is MM/DD/YYYY, so it will convert it to YYYYMMDD.  If I send another format like DD/MM/YYYY it doesn't work.  I really think that you need to validate the entry of your date so that it is in the correct format.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;

REPORT ZRICH_0002 .


data: date(10) type c value '12/31/2005'.
data: new_date type sy-datum.


call function 'CONVERT_DATE_TO_INTERNAL'
  exporting
    date_external                  = date
 IMPORTING
   DATE_INTERNAL                  = new_date
 EXCEPTIONS
   DATE_EXTERNAL_IS_INVALID       = 1
   OTHERS                         = 2.
          .
if sy-subrc &amp;lt;&amp;gt; 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.

write:/ new_date.

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Rich Heilman&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 09 Dec 2005 14:39:32 GMT</pubDate>
    <dc:creator>RichHeilman</dc:creator>
    <dc:date>2005-12-09T14:39:32Z</dc:date>
    <item>
      <title>Date conversion</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/date-conversion/m-p/1074168#M95769</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;I am using a field from the database that holds date in the format YYYYMMDD.&lt;/P&gt;&lt;P&gt;Now i need to compare this field with another field that the user populates which can be in any form DD.MM.YYYY(mostly) or MM.DD.YYYY. &lt;/P&gt;&lt;P&gt;Is anybody aware of a function module that can do the same convert from DD.MM.YYYY to YYYYMMDD.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks &amp;amp; Regards,&lt;/P&gt;&lt;P&gt;Vanita.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 09 Dec 2005 14:36:59 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/date-conversion/m-p/1074168#M95769</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-12-09T14:36:59Z</dc:date>
    </item>
    <item>
      <title>Re: Date conversion</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/date-conversion/m-p/1074169#M95770</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;try using convert_date_to_internal.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 09 Dec 2005 14:38:24 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/date-conversion/m-p/1074169#M95770</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-12-09T14:38:24Z</dc:date>
    </item>
    <item>
      <title>Re: Date conversion</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/date-conversion/m-p/1074170#M95771</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try this.  I believe that this function module works from the user defaults, meaning that it will except the date as it is formatted by the user defaults.  In my system,  my default is MM/DD/YYYY, so it will convert it to YYYYMMDD.  If I send another format like DD/MM/YYYY it doesn't work.  I really think that you need to validate the entry of your date so that it is in the correct format.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;

REPORT ZRICH_0002 .


data: date(10) type c value '12/31/2005'.
data: new_date type sy-datum.


call function 'CONVERT_DATE_TO_INTERNAL'
  exporting
    date_external                  = date
 IMPORTING
   DATE_INTERNAL                  = new_date
 EXCEPTIONS
   DATE_EXTERNAL_IS_INVALID       = 1
   OTHERS                         = 2.
          .
if sy-subrc &amp;lt;&amp;gt; 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.

write:/ new_date.

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Rich Heilman&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 09 Dec 2005 14:39:32 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/date-conversion/m-p/1074170#M95771</guid>
      <dc:creator>RichHeilman</dc:creator>
      <dc:date>2005-12-09T14:39:32Z</dc:date>
    </item>
    <item>
      <title>Re: Date conversion</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/date-conversion/m-p/1074171#M95772</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Vanita!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Usually you define input fields also as type of date (e.g. like sy-datum). Then conversion is done automatically (and you have F4-calendar).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Otherwise you can give FM CONVERSION_EXIT_DATEX_INPUT a try ( or directly DATE_STRING_CONVERT).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Christian&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 09 Dec 2005 14:39:57 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/date-conversion/m-p/1074171#M95772</guid>
      <dc:creator>christian_wohlfahrt</dc:creator>
      <dc:date>2005-12-09T14:39:57Z</dc:date>
    </item>
    <item>
      <title>Re: Date conversion</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/date-conversion/m-p/1074172#M95773</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;alternatively you can convert the internal date format into external date format also.&lt;/P&gt;&lt;P&gt;Use &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;write date_internal to date_external.&lt;/P&gt;&lt;P&gt;where date_internal is type sy-datum and date_external is type char10.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then you can use the date_external for comparision purposes.&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Ravi&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 09 Dec 2005 14:44:28 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/date-conversion/m-p/1074172#M95773</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-12-09T14:44:28Z</dc:date>
    </item>
    <item>
      <title>Re: Date conversion</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/date-conversion/m-p/1074173#M95774</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Use this FM &amp;lt;b&amp;gt;convert_date_to_internal.&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 09 Dec 2005 14:44:42 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/date-conversion/m-p/1074173#M95774</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-12-09T14:44:42Z</dc:date>
    </item>
    <item>
      <title>Re: Date conversion</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/date-conversion/m-p/1074174#M95775</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 with RP_FORMATING_DATE&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Eswar&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 09 Dec 2005 14:53:45 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/date-conversion/m-p/1074174#M95775</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-12-09T14:53:45Z</dc:date>
    </item>
    <item>
      <title>Re: Date conversion</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/date-conversion/m-p/1074175#M95776</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Here is the link where u can get all the function modules&lt;/P&gt;&lt;P&gt;of conversions.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.geocities.com/victorav15/sapr3/abapfun.html#date" target="test_blank"&gt;http://www.geocities.com/victorav15/sapr3/abapfun.html#date&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Sharath&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 09 Dec 2005 14:54:07 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/date-conversion/m-p/1074175#M95776</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-12-09T14:54:07Z</dc:date>
    </item>
  </channel>
</rss>

