‎2007 Feb 14 9:56 AM
Hi All,
Is there any function module which accepts date in any format and outputs in the user specified format?
Thanks,
Anil.
‎2007 Feb 14 10:01 AM
hi,
1)
data: gd_date(10). "field to store output date
Converts SAP date from 20020901 to 01.09.2002
write sy-datum to gd_date dd/mm/yyyy.
Converts SAP date from 20020901 to 01.09.02
write sy-datum to gd_date dd/mm/yy.
2)
data: gd_date(8). "field to store output date
Converts SAP date from 20010901 to 01092001
gd_date(2) = sy-datum+6(2).
gd_date2(2) = sy-datum4(2).
gd_date+4(4) = sy-datum(4).
3)
data: gd_date(8). "field to store output date
Converts date from 20010901 to 01SEP2001
gd_date = sy-datum.
CALL FUNCTION 'CONVERSION_EXIT_IDATE_OUTPUT'
EXPORTING
input = gd_date
IMPORTING
OUTPUT = gd_date.
Regards,
Bijal
‎2007 Feb 14 10:04 AM
Hi,
Use the FM:
<b>CONVERT_DATE_TO_EXTERNAL</b> Converts date from system storage format to users specified display format
Hope this helps.
Reward if helpful.
Regards,
Sipra
‎2007 Feb 14 10:08 AM
Hi
use the FM:
CONVERT_DATE_TO_EXTERNAL
which can be used to convert the date format from SAP formatt to user defined format.
Regards,
kumar
‎2007 Feb 14 10:25 AM
Hi,
You can use this logic.
w_date = syst-datum.
Select the Date format for the User.
SELECT SINGLE datfm INTO w_format
FROM usr01
WHERE bname EQ syst-uname.
IF syst-subrc IS INITIAL.
CASE w_format.
WHEN '1'.
CONCATENATE w_date0(4) w_date4(2) w_date+6(2)
INTO w_date.
WHEN '2' OR '3'.
CONCATENATE w_date0(4) w_date4(2) w_date+6(2)
INTO w_date.
WHEN OTHERS.
ENDCASE.
regards,
Mahesh
‎2007 Feb 14 10:59 AM
check fm
DATE_STRING_CONVERT
here in DATE_FORMAT you have to check the format
in my case
1 DD.MM.YYYY
2 MM/DD/YYYY
3 MM-DD-YYYY
4 YYYY.MM.DD
5 YYYY/MM/DD
6 YYYY-MM-DD
here if you pass 1 in DATE_FORMAT
DATE_STRING must be like 01/11/2007
it will return 01.11.2007.
here if you pass 5 in DATE_FORMAT
DATE_STRING must be like 2007/11/31
it will return 31.11.2007.
just check that ...
regards
shiba dutta