‎2009 Mar 10 4:36 AM
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.
‎2009 Mar 10 4:38 AM
FM HR_IN_GET_DATE_COMPONENTS
Edited by: Sravan Kumar on Mar 10, 2009 5:41 AM
‎2009 Mar 10 4:39 AM
you can check IDATE,SDATE,LDATE Conversion Function module. Always search before posting.
‎2009 Mar 10 4:39 AM
‎2009 Mar 10 4:40 AM
Hi,
As per my knowledge no FM like. But you can use Replace statement where '.' find you can replace '-'. Finally you can get requirement.
Regards
Md.MahaboobKhan
‎2009 Mar 10 4:43 AM
Hi,
Please use FM : CONVERT_DATE_TO_INTERN_FORMAT
to convert date in to internal format.
Regards,
Tarun
‎2009 Mar 10 4:44 AM
hi friend look my following example.
To format date fields, use the SAPscript SET DATE MASK command. Executing this command causes all subsequent date fields to be printed with the specified formatting.
Syntax
/: SET DATE MASK = 'date_mask'
The following templates may be used in the date mask:
DD day (two digits)
DDD name of day (abbreviated)
DDDD name of day (written out in full)
MM month (two digits)
MMM name of month (abbreviated)
MMMM name of month (written out in full)
YY year (two digits)
YYYY year (four digits)
LD day (formatted as for the L option)
LM month (formatted as for the L option)
LY year (formatted as for the L option)
Any other characters occurring in the mask are interpreted as simple text and are copied directly to the output.
Assuming a current system date of March 1st, 1997.
/: SET DATE MASK = 'Foster City, MM.DD.YY'
&DATE& -> Foster City, 03.01.97
&DATE(Z)& -> Foster City, 3.1.97
/: SET DATE MASK = 'MMMM DD, YYYY'
&DATE& -> March 01, 1997
You can revert to the standard setting by using the SET DATE MASK command again with an empty string in place of the date mask:
/: SET DATE MASK = ' '
‎2009 Mar 10 4:48 AM
Hi,
The FM CONVERSION_EXIT_SDATE_OUTPUT will convert the date format 20090310 to 10.MAR.2009.
or the FM CONVERSION_EXIT_IDATE_OUTPUT
Keerthi
Edited by: Keerthy K on Mar 10, 2009 5:50 AM
‎2009 Mar 10 4:49 AM
Hi,
try this...
data: ws_input type sy-datum,
ws_date type char20.
ws_input = '20080321'.
CALL FUNCTION 'CONVERSION_EXIT_SDATE_OUTPUT'
EXPORTING
input = ws_input
IMPORTING
OUTPUT = ws_date
.
Replace All Occurences of '.' IN ws_date with '-'.
write ws_date.
Thanks
Arun
‎2009 Mar 10 4:51 AM
Hi Ashok,
Try the following piece of code
data d1 type d .
data d2(20).
d1 = sy-datum.
write sy-datum.
CALL FUNCTION 'CONVERSION_EXIT_SDATE_OUTPUT'
EXPORTING
INPUT = d1
IMPORTING
OUTPUT = d2.
replace all occurrences of '.' in d2 with '-'.
write / d2.
This would give you the desired output.
Regards,
Sachin
‎2009 Mar 10 4:55 AM
Hi,
Try with the following function modules these may help you
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_OUTPUT Internal date OUTPUT conversion exit (e.g. YYYYMMDD)
Thank U,
Jay....
‎2009 Mar 10 4:56 AM
Hi,
go through the piece of code .....i hope u will get some help
DATA X_MONTH(11).
CALL FUNCTION 'CONVERSION_EXIT_LDATE_OUTPUT'
EXPORTING
INPUT = SY-DATUM
IMPORTING
OUTPUT = X_MONTH.
WRITE:/ 'Month in words', X_MONTH+3(8).
you can then concatenate according to the need with the date..
thanks & Regards
Ashu Singh
‎2009 Mar 10 5:02 AM
Hi ,
U can use FM /SAPDMC/LSM_DATE_CONVERT
to convert into both internal and External Date formats.
Just need to give correct "date_format_in"
Thanks
Raj
‎2009 Mar 10 5:14 AM
Hi,
You can try using this function module:
CONVERSION_EXIT_IDATE_OUTPUT
Hope it helps
Regrds
Mansi
‎2009 Mar 10 5:48 AM
You can create your own fumction module for this
Input the date in character 10 format and output the date also in character 10 format.
Following sample code will help you complete the logic
Data :
Date_in(10) TYPE C,
Date_out(10) type c,
To_mmm(3) type c,
l_separator,
l_dd(2),
l_mm(2),
l_yyyy(4).
*Check the date in and find the separator
CONDENSE DATE_IN NO-GAPS.
IF DATE_IN CN '0123456789 '.
L_SEPARATOR = DATE_IN+SY-FDPOS(1).
ENDIF.
get date,month and year separated from the date_in
IF NOT L_SEPARATOR IS INITIAL.
SPLIT DATE_IN AT L_SEPARATOR INTO L_DD L_MM L_YYYY.
*convert the month number to text
*complete all month cases as shown for JAN
Case l_mm.
when '1'.
to_mmm = 'JAN'.
when '2'.
when '3'.
when '4'.
when '5'.
when '6'.
when '7'.
when '8'.
when '9'.
when '10'.
when '11'.
when '12'.
endcase.
*build the output date
Perform build_date using l_dd to_mmm l_yyyy '-'
CHANGING DATE_OUT.
FORM BUILD_DATE USING P_1
P_2
P_3
P_SEPARATOR
CHANGING P_RESULT.
CONCATENATE P_1 P_SEPARATOR
P_2 P_SEPARATOR
P_3 INTO P_RESULT.
ENDFORM. " BUILD_DATE
‎2009 Jun 18 6:25 AM
Dear Friends,
Thank you very much for all your Valuable replies.
Thanks & Regards,
Ashok.
‎2009 Mar 10 6:40 AM
REPORT ZSAR_DATE_FORMAT. TABLES: T247. DATA : dd(2) TYPE c, mm(2) TYPE c, mon(3) TYPE c, yy(4) TYPE c, new_date(11) TYPE c. PARAMETERS: Date(10) TYPE C. SPLIT Date AT '-' INTO dd mm yy. SELECT SINGLE ktx FROM T247 INTO mon WHERE spras = sy-langu AND mnr = mm. CONCATENATE dd '-' mon '-' yy INTO new_date. WRITE: / new_date.
please run the above program to get your desired format.
Thanks.
‎2009 Mar 10 11:27 AM
Hi Ashok!!
Are you still watching the thread? have not got your desired answer/output? If you get it, please mark the thread as ANSWERED.
Thanks and Regards.
‎2009 Mar 10 11:28 AM
>
> Hi Ashok!!
> Are you still watching the thread? have not got your desired answer/output? If you get it, please mark the thread as ANSWERED.
>
> Thanks and Regards.
Aren't you......??
‎2009 Mar 10 11:38 AM
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
‎2009 Mar 17 12:57 PM
Hi Ashok!!
Are you still watching the thread? have not got your desired answer/output? If you get it, please mark the thread as ANSWERED.
Thanks and Regards.
‎2009 Mar 19 2:37 PM
Hi Ashok!!
Are you still watching the thread? have not got your desired answer/output? If you get it, please mark the thread as ANSWERED.
Thanks and Regards.
Sarbajit.
‎2009 Mar 26 11:21 AM
Hi Ashok!!
Are you still watching the thread? have not got your desired answer/output? If you get it, please mark the thread as ANSWERED.
Thanks and Regards.
Sarbajit.
‎2009 Mar 26 11:35 AM
hi,
use this.
Function module HR_IN_GET_DATE_COMPONENTS
Import parameters Value
IDATE 23.03.2009
Export parameters Value
DAY 23
MONTH 03
YEAR 2009
STEXT MAR
LTEXT March
USERDATE 23.03.2009
use these export parameters for ur result.