Converting SAP Date format yyyyMMdd to MM/dd/yyyy
What FM can be used to convert the date from SAP's date yyyyMMdd to MM/dd/yyyy?
Moderator message: FAQ, please search for available information/documentation.
Edited by: Thomas Zloch on Mar 9, 2011 4:05 PM
What FM can be used to convert the date from SAP's date yyyyMMdd to MM/dd/yyyy?
Moderator message: FAQ, please search for available information/documentation.
Edited by: Thomas Zloch on Mar 9, 2011 4:05 PM
Similar Messages
-
Convert date format YYYYMMDD to DD.MM.YYYY
hi
i was wondering is there a FM which convert date format YYYYMMDD to DD.MM.YYYY
instead of u know cutting the YYYY and MM and DD and concatement them againHi ,
See this piece of code
Data : w_date type dats value '20080903',
w_date1(10),
Constants : C(1) value '.'.
w_date1 = w_date.
concatenate w_date+6(2) w_date+4(2) w_date+0(4) into w_date1 separated by C.
Write : / w_date1.
With Regards.
Alwasy Learner -
How to change the date format YYYYMMDD to MM/DD/YYYY
Hi ,
How to change the date format YYYYMMDD to MM/DD/YYYY .
Ex : 20071008 to 10/08/2007
Is there any function module for this ??
Regards
RahulHi Sharma,
check the code:
SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME TITLE text-031.
PARAMETERS: date1 RADIOBUTTON GROUP rad1 DEFAULT 'X', "SAP date format YYYYDDMM
date2 RADIOBUTTON GROUP rad1, "Date format like aprial31, 2006
date3 RADIOBUTTON GROUP rad1, "Date format like 31 apr,2006
date4 RADIOBUTTON GROUP rad1, "Date format like DD/MM/YYYY
date5 RADIOBUTTON GROUP rad1. "Date format like DD.MM.YYYY
SELECTION-SCREEN END OF BLOCK b2
FORM getmonth .
SELECT mnr
ktx
ltx
INTO TABLE T_month
FROM t247
WHERE spras = 'EN'.
IF sy-subrc NE '0'.
MESSAGE I "Message - Not able to get month values from the table T247
ENDIF.
ENDFORM.
DATA : temp_date(16) TYPE c,
temp1_date(60) TYPE c,
year(4) TYPE c,
daymonth(11) TYPE c,
daymonth1(11) TYPE c,
month(9) TYPE c,
day(2) TYPE c,
mon LIKE t247-ktx,
len TYPE i .
MOVE date TO temp1_date .
CONDENSE temp1_date NO-GAPS.
MOVE temp1_date TO temp_date .
IF date2 EQ 'X'. "The date format is like Aprial 31, 2007
CONDENSE temp_date NO-GAPS.
SPLIT date AT ',' INTO daymonth year.
IF STRLEN( year ) NE '4'.
error = 'X'.
WRITE : 'Invalid date format.'.
ELSE.
daymonth1 = daymonth.
CONDENSE daymonth1 NO-GAPS.
_len = STRLEN( _daymonth1 ).
l_len = 13 - len.
SHIFT daymonth1 RIGHT BY len PLACES.
CONDENSE daymonth1 NO-GAPS.
month = daymonth1.
CONDENSE month NO-GAPS.
SORT t_month BY monthltx.
READ TABLE t_month WITH KEY monthltx = month.
IF sy-subrc <> 0.
error = 'X'.
WRITE : 'Invalid date format.' .
ELSE.
len = STRLEN( month ).
CONDENSE daymonth NO-GAPS.
SHIFT daymonth LEFT BY len PLACES.
day = daymonth.
CONDENSE day NO-GAPS.
CONCATENATE year t_month-monthnumber day INTO o_date.
ENDIF.
ENDIF.
ELSEIF p_date3 EQ 'X'. "The date format is like 31 apr, 2007
CONDENSE temp_date NO-GAPS.
SPLIT i_date AT ',' INTO daymonth year.
IF STRLEN( year ) NE '4'.
error = 'X'.
WRITE : 'Invalid date format.'.
ELSE.
daymonth1 = daymonth.
CONDENSE daymonth1 NO-GAPS.
SHIFT daymonth1 LEFT BY 2 PLACES.
CONDENSE daymonth1 NO-GAPS.
month = daymonth1.
CONDENSE month NO-GAPS.
TRANSLATE month TO UPPER CASE.
SORT t_month BY monthstx.
MOVE month to mon.
READ TABLE t_month WITH KEY monthstx = mon.
IF sy-subrc <> 0.
error = 'X'.
WRITE : 'Invalid date format.' .
ELSE.
CONDENSE daymonth NO-GAPS.
day = daymonth+0(2).
CONDENSE day NO-GAPS.
CONCATENATE year t_month-monthnumber day INTO o_date.
ENDIF.
ENDIF.
ELSEIF p_date4 EQ 'X' OR p_date5 EQ 'X'. "Date format is like DD.MM.YYYY or DD/MM/YYYY
CONDENSE temp_date NO-GAPS.
IF STRLEN( temp_date ) EQ 10.
o_date0(4) = temp_date6(4).
o_date4(2) = temp_date3(2).
o_date6(2) = temp_date0(2).
ELSE.
error = 'X'.
WRITE : 'Invalid date format.' .
ENDIF.
ENDIF.
IF STRLEN( o_date ) NE '8'.
error = 'X'.
WRITE : 'Invalid date format.'.
ENDIf.
ENDFORM. " f0100_conv_date
Reward if helpful.
Regards,
Harini.S -
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.
ArunHi, 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 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,
SuryaHi,
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 -
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 -
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 Joyhi
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 -
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
VamsiHi 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 -
Reg : date format conversion from dd.mm.yyyy to mmddyyyy
hi ALL,
is there any function module which can convert date format
from <b>dd.mm.yyyy to mmddyyyy</b>.
Thanks in advanceHi,
Please check the following
CONVERSION_EXIT_PDATE_INPUT Conversion Exit for Domain GBDAT: DD/MM/YYYY -> YYYYMMDD
CONVERSION_EXIT_PDATE_OUTPUT Conversion Exit for Domain GBDAT: YYYYMMDD -> DD/MM/YYYY
SCA1 Date: Conversion
CONVERSION_EXIT_IDATE_INPUT External date INPUT conversion exit (e.g. 01JAN1994)
CONVERSION_EXIT_IDATE_OUTPUT External date OUTPUT conversion exit (e.g. 01JAN1994)
CONVERSION_EXIT_LDATE_OUTPUT Internal date OUTPUT conversion exit (e.g. YYYYMMDD)
CONVERSION_EXIT_SDATE_INPUT External date (e.g. 01.JAN.1994) INPUT conversion exit
CONVERSION_EXIT_SDATE_OUTPUT Internal date OUTPUT conversion exit (e.g. YYYYMMDD)
TB01_ADDON
CONVERSION_EXIT_DATEX_INPUT
CONVERSION_EXIT_DATEX_OUTPUT
Hope this would surely help you out.
Thanks and regards,
Varun. -
Function module to change Date from YYYYMMDD to DD.MM.YYYY
Hi
PLease tell me the function module that will convert date from YYYYMMDD to DD.MM.YYYY
ThanksHi,
data lv_date1 type sy-datum.
data lv_date2(12).
lv_date1 = '20070123'.
concatenate lv_date16(2) lv_date14(2) lv_date1+0(4) into lv_date2
separated by '.' .
is what you require to do;
now lv_date2 = 23.01.2007.
Also look for conversion routine "CONVERSION_EXIT_PDATE_OUTPUT"
EG: call function CONVERSION_EXIT_PDATE_OUTPUT
exporting input = lv_date1
importing output = lv_date2.
Thanks,
Anitha -
How to change date format in select-option (mm.yyyy).
Hi,
Plz, How to change date format in select-option (mm.yyyy).
in my selection screen date type selection-option is there ,when i am enter date it's taken dd.mm.yyyy format,but i want mm.yyyy format.
how to set that .
Regards,
Kk.sorry
parameters : pmonyr type spmon or
select-options : sspmon for PGPL-spmon .
or what table ccontains spmon.
regards
shiba dutta -
Can we change the date format to be dd/mm/yyyy?
Can we change the date format to be dd/mm/yyyy?
Hello leahmaree,
Yes, you can:
Click the Options tab
Click the Language & Formatting label
Set the Date Order preference
I hope that helps,
Brian -
Convert SAP format YYYYMMDD to MM/DD/YYYY format.
Hi folks,
I using a ALV FM (K_KKB_FIELDCAT_MERGE)to display the data using.In 4.6 version the date format used to display in MM/DD/YYY format whereas after the upgrade to ECC 6.0 version the date format is know dispalying in Sap std format YYYYMMMDD.
Any suggestion to display the date in US format.
Cheers.wa_fieldcat-fieldname = 'AR_DATE'.
wa_fieldcat-ref_table = 'ROCTAB'.
wa_fieldcat-ref_field = 'AR_DATE'.
wa_fieldcat-reptext = text.
wa_fieldcat-col_pos = index.
APPEND wa_fieldcat TO t_fieldcat.
CLEAR wa_fieldcat. -
Date Format Conversion from MM.DD.YYYY to YYYYMMDD
Hi All,
I am trying to load data from r/3, and i have date format as MM.DD.YYYY in source system.how can i convert this into YYYYMMDD format in transfer rules(I know that we have to write a routine in transfer rules).Could anybody help me out pl?..pl give me conversion routine for it.
Here BW Filed is 0DATE and R/3 Filed is ZZDATE.
regards
murali.
Message was edited by: MuraliHi,
Try to under stand what I am asking :
<b>What is the domain(or data type) used for the ZZDATE field.</b>
Ok ,
If some records are having proper format and others are having wrong format, even we canot correct this with routine also. So in this case you have to edit manually at PSA, then do upload.
You are right, when we are populating data to ODS , if there is any wrong format of value, it will not disply the error at the time of loading .It will through the error at the time of activation.
With rgds,
Anil Kumar Sharma .P -
Working with SAP Data Format yyyy.mm.dd in data services
Hi,
I had 2 questions about date formats coming from SAP to DS .
1) I am trying to convert date fieild from SAP that is formated to yyyy.mm.dd to mm/dd/yyyy but I am not having any luck .. I am using the to_date function when I run this below I get null values in my template table . I think it has to do with me not stating my input date format but cannot seem to get the correct syntax's any ideas ?
2) Does Data Services recognize dates which are formatted as yyyy.mm.dd ?? When I put I added a column to a template table and added the sys date command it returned the sys date as yyyy.mm.dd BUT when I try a fiscal_day function (which should brings back the number of days between the input (my SAP source date ) and the sys date which are formatted the same (yyyy.mm.dd) I get a format error (input parameter 2009.03.10 is not valid) . any ideas ?
Thanks for your time,
BrettHello Brett
to_date convert STRING to date based on input format.
As i understand your source data not in string format.Is this correct?
Use combination to_char->to_date for your transformation
Regards
Kanstantsin Chernichenka
Maybe you are looking for
-
How do I get the "Current News Headlines" app back on Firefox
On another computer in the house, there is a link just below the toolbar titled Current News Headlines which takes you to a list of news stories. It's not on my computer and I want to re-establish it. The help file says to go to View/Sidebar/Bookmark
-
What's the maximum ammount of connection the Stratus can support
i wonder as if the Stratus service has a limit of connections. also wonder as if it is stable enough to ran when i try to use it in a project like realtime web game.
-
Recent Update has messed up my firefox browser. If I set a new homepage, the next time I turn-off then turn on my computer the homepage is reset to default. Any sort of setting I change, reverts to default if I turn off my computer and turn in on aga
-
I'm seeing a similiar issue as reported against apache in Tomcat 5.5 http://www.merchantpal.net/modules.php?name=News&file=article&sid=91 The fix for this IE 6 bug in apache is to add SetEnvIf User-Agent ".*MSIE.*" nokeepalive ssl-unclean-shutdown do
-
Batch file to "Disable" un-used plug-ins etc.
Hi Folks!! I've got into the habit (from the good old, small PC, WinXP days) of disabling with the pre-fix ~ (tilde) method, all the presets and plug-ins that I never use as soon as I install Photoshop. Doing it manually in those days was not too muc