2008 Aug 01 7:02 AM
1) In output I am getting the date in the format of MM/DD/YYYY. Instead of that I need in the format of YYYY/MM/DD? Can anybody help for code?
2008 Aug 01 7:05 AM
hiii
use FM
data : date1(10) type c value '28.01.2008',
date2 type sy-datum.
CALL FUNCTION 'CONVERT_DATE_TO_INTERNAL'
EXPORTING
date_external = date1
IMPORTING
DATE_INTERNAL = date2or you can use following logic on date
s_date+0(4) = sy-datum+0(4)
s_date+4(1) = '/'
s_date+5(2) = sy-datum+4(2)
s_date+7(1) ='/'
s_date+8(2) =sy-datum+6(2)regards
twinkal
1) In output I am getting the date in the format of MM/DD/YYYY. Instead of that I need in the format of YYYY/MM/DD? Can anybody help for code?
2008 Aug 01 7:02 AM
2008 Aug 01 7:05 AM
hiii
use FM
data : date1(10) type c value '28.01.2008',
date2 type sy-datum.
CALL FUNCTION 'CONVERT_DATE_TO_INTERNAL'
EXPORTING
date_external = date1
IMPORTING
DATE_INTERNAL = date2or you can use following logic on date
s_date+0(4) = sy-datum+0(4)
s_date+4(1) = '/'
s_date+5(2) = sy-datum+4(2)
s_date+7(1) ='/'
s_date+8(2) =sy-datum+6(2)regards
twinkal
2008 Aug 01 7:08 AM
2008 Aug 01 7:09 AM
date 08/01/2008.
move date to date1 edit mask 01/08/2008.
Paras
2008 Aug 01 7:11 AM
Hi,
Try using fm: FORMAT_DATE_4_OUTPUT
Raward if helpful,
Regards,
Sagar.
2008 Aug 01 7:20 AM
output I am getting the date in the format of MM/DD/YYYY. Instead of that I need in the format of YYYY/MM/DD?
hi
if u r displaying the field using write st
then go with
write: var4(4) '/' var2(2) '/' var+0(2).
or else store the concatenated value of
var4(4) '/' var2(2) '/' var+0(2).
into another variable and display the second variable
reward points if helpful
2008 Aug 01 7:32 AM
Hi,
If you are referring to standard output to change to required format, following steps will help.
Follow menu path System --> User Profile --> Defaults tab --> Change Date Format to YYYY/MM/DD.
Note : Above settings will be user specific.
Regards,
Mohaiyuddin
2008 Aug 01 7:35 AM
Hi Kanneganti.
I would like to suggest,
CONVERT_DATE_FORMAT - Convert date from yyyymmdd to ddmmyyyy format
I would like to suggest a reference,
[SDN Code Gallery - Standard Reference for FUNCTION MODULE FOR CONVERTING DATE INTO THE GIVEN FORMAT|https://www.sdn.sap.com/irj/sdn/wiki?path=/display/snippets/function%2bmodule%2bfor%2bconverting%2bdate%2binto%2bthe%2bgiven%2bformat]
Hope that's usefull.
Good Luck & Regards.
Harsh Dave
2008 Aug 01 7:49 AM
hi,
this code will help you.
if u want to convert the format from dd.mm.yyyy to yyyy.mm.dd.
first split it .
Declare three variables like date,month, year to capture the values of date. month & year respectively.
to do this use offset.
and then concatenate it according to ur requirement.
i am sending here the code for that.
regards
Nilabichi.
REPORT ZDATE_CONVERSION.
data : var type ersda ,
var_1(20) TYPE c,
year(5) TYPE c,
month(5) TYPE c,
date(5) TYPE c.
var = '01082008'.
year = var+4(4).
month = var+2(2).
date = var+0(2).
CONCATENATE year'/' month '/' date INTO var_1 SEPARATED BY space.
WRITE :var_1.
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |