2007 Feb 23 9:31 AM
Hi
I need to convert the date from 08/31/2006 to 31-Aug-06 format.
Plz help me out. Useful answers will be rewarded. Thanks in advance.
Hi
I need to convert the date from 08/31/2006 to 31-Aug-06 format.
Plz help me out. Useful answers will be rewarded. Thanks in advance.
2007 Feb 23 9:34 AM
split the date in to required blocks using "Split" command and try it out your requirement
2007 Feb 23 9:34 AM
Hello,
Check the table :
T247
Check these fm's
Function Modules related to Date and Time Calculations
DATE_COMPUTE_DAY : Returns weekday for a date
DATE_GET_WEEK : Returns week for a date
DAY_ATTRIBUTES_GET : Returns attributes for a range of dates specified
MONTHS_BETWEEN_TWO_DATES : To get the number of months between the two dates.
END_OF_MONTH_DETERMINE_2 : Determines the End of a Month.
HR_HK_DIFF_BT_2_DATES : Find the difference between two dates in years, months and days.
FIMA_DAYS_AND_MONTHS_AND_YEARS : Find the difference between two dates in years, months and days.
MONTH_NAMES_GET : Get the names of the month
WEEK_GET_FIRST_DAY : Get the first day of the week
HRGPBS_HESA_DATE_FORMAT : Format the date in dd/mm/yyyy format
SD_CALC_DURATION_FROM_DATETIME : Find the difference between two date/time and report the difference in hours
L_MC_TIME_DIFFERENCE : Find the time difference between two date/time
HR_99S_INTERVAL_BETWEEN_DATES : Difference between two dates in days, weeks, months
LAST_DAY_OF_MONTHS : Returns the last day of the month
Vasanth
2007 Feb 23 9:35 AM
2007 Feb 23 9:37 AM
Refer this
Currently my date is getting printed in format 05262005.
I want the output as 26 May, 2005.
I have tried using Set date mask option but it is not picking up in the output.
Code:
This code yields as 12 march 2006.
DATA: ZTEMP(9).
CLEAR: ZTEMP, ZDD, ZMMM, ZYYYY.
CALL FUNCTION 'CONVERSION_EXIT_IDATE_OUTPUT'
EXPORTING
INPUT = IS_DLV_DELNOTE-HD_GEN-CREA_DATE
IMPORTING
OUTPUT = ZTEMP.
ZDD = ZTEMP+3(2).
ZMMM = ZTEMP+0(3).
ZYYYY = ZTEMP+5(4).
then u can c<b>oncatenate zdd zmmm zyyy INTO zdate seperated by '-'.</b>
http://www.sap-img.com/abap/abap-program-output-of-date-format.htm
Reward if this helps.
2007 Feb 23 9:59 AM
hi Vijay,
TRY THIS CODE.
DATA : W_DATE TYPE CHAR10 VALUE '08/06/2007',
W_DATE1 TYPE D,
W_DATE2 TYPE CHAR12,
W_DATE3 TYPE CHAR15.
CALL FUNCTION 'RP_FORMATING_DATE'
EXPORTING
date_i = W_DATE
BIRTH_DATE = 'X'
IMPORTING
DATE_O = W_DATE1
EXCEPTIONS
DATE_INVALID = 1
OTHERS = 2
.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CALL FUNCTION 'CONVERSION_EXIT_IDATE_OUTPUT'
EXPORTING
input = W_DATE1
IMPORTING
OUTPUT = W_DATE2
.
CONCATENATE W_DATE20(2) '-' W_DATE22(3) '-' W_DATE2+5(4) INTO W_DATE3.
WRITE : W_DATE3.
This will surely help u.
Regards,
Santosh.
2007 Feb 23 10:00 AM
2007 Feb 23 10:10 AM
Get date month year in diff variables and concatnate it into one variable in which way do u need.
2007 Feb 23 10:15 AM
hi Vijay,
i dint notice that u are asking for mm/dd/yyyy format in the input.
below is the code with a little change.
DATA : W_DATE TYPE CHAR10 VALUE '08/31/2006',
W_DATE1 TYPE D,
W_DATE2 TYPE CHAR12,
W_DATE3 TYPE CHAR15.
<b>concatenate w_date3(2) '/' w_date0(2) '/' w_date+6(4) into w_date.</b>
CALL FUNCTION 'RP_FORMATING_DATE'
EXPORTING
date_i = W_DATE
BIRTH_DATE = 'X'
IMPORTING
DATE_O = W_DATE1
EXCEPTIONS
DATE_INVALID = 1
OTHERS = 2
.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CALL FUNCTION 'CONVERSION_EXIT_IDATE_OUTPUT'
EXPORTING
input = W_DATE1
IMPORTING
OUTPUT = W_DATE2
.
<b> CONCATENATE W_DATE20(2) '-' W_DATE22(3) '-' W_DATE2+7(2) INTO W_DATE3</b>.
WRITE : W_DATE3.
the input is 08/31/2006 and the out put is 31-AUG-06 this is what u want right.
2007 Feb 23 10:25 AM
Hi,
DATA: gd_datetext TYPE string.
CASE sy-datum+4(2).
WHEN '01'.
gd_datetext = 'Jan'.
WHEN '02'.
gd_datetext = 'Feb'.
WHEN '03'.
gd_datetext = 'March'.
WHEN '04'.
gd_datetext = 'April'.
WHEN '05'.
gd_datetext = 'May'.
WHEN '06'.
gd_datetext = 'June'.
WHEN '07'.
gd_datetext = 'July'.
WHEN '08'.
gd_datetext = 'Aug'.
WHEN '09'.
gd_datetext = 'Sept'.
WHEN '10'.
gd_datetext = 'Oct'.
WHEN '11'.
gd_datetext = 'Nov'.
WHEN '12'.
gd_datetext = 'Dec'.
ENDCASE.
concatenate sy-datum(2)'-'gd_datetext'-'sy-datum+2(2) into
gd_datetext.
.
write:/ gd_datetext.
Regards,
Sruthi
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |