05-17-2006 6:52 AM
Hi All,
Can any one tell me how to convert date from one format to another...
I have a date in the format dd.mm.yyyy
I would like to convert this into yyyy.mm.dd
Is there any function module to do this.
please send me the full details..
thanks and regards
raghu
05-17-2006 6:58 AM
Hi Raghu Danda,
Try this code.
data: str1 type string,
str2 type string.
str1 = 10.06.2006
10.06.2006
0123456789
concatenate str16(4) '.' str13(2) '.' str1.0(2) into str2.
write str2.
str2 will be in the format yyyy.mm.dd
i.e. 2006.06.10
Hope it solves your problem.
Regards,
Maheswaran.B
05-17-2006 7:00 AM
Use any of the foll. FM
You pass your internal table date format dd.mm.yyyy to Function module CONVERT_DATE_TO_INTERNAL
to get the date format as yyyymmdd.
HRGPBS_HESA_DATE_FORMAT
Format a date valid for HESA: DD/MM/YYYY
HRGPBS_TPS_DATE_FORMAT
Format a date valid for TPS: DDMMYY
SLS_MISC_GET_USER_DATE_FORMAT
get the date format the user has defined as his/her default
Message was edited by: kishan negi
05-17-2006 6:59 AM
Use write statement.
use f1 or goto pattarn -> WRITE -> FIELD(specify name)->
Multiple selection(yellow arrow button button)-> for date fields (Chck box and radio button)
WRITE - Formatting options
... DD/MM/YY
... MM/DD/YY
... DD/MM/YYYY
... MM/DD/YYYY
... DDMMYY
... MMDDYY
... YYMMDD
U can use into another variable.
and then use that particular variable.
DATA: lv_date(10) type c, fi_date(10) type c.lv_date = '2006.03.02'.CONCATENATE lv_date8(2) '.' lv_date5(2) '.' lv_date+0(4) into fi_date.write: fi_date.
regards
vinod
05-17-2006 7:04 AM
Hi,
REPORT ztest LINE-SIZE 1023..
DATA : s TYPE string.
DATA : d TYPE string.
s = '17.05.2006'.
CONCATENATE s+6(4) s+3(2) s(2) INTO d separated by '.'.
WRITE 😕 d.
Regards,
Anjali
05-17-2006 7:20 AM
Date formatting
The following code demonstrates a number of ways to format a date value:
Using the WRITE statement
***************************
data: gd_date(10).
"field to store output date
* Converts date from 20020901 to 01.09.2002
write sy-datum to gd_date dd/mm/yyyy.
<b>* Converts date from 20020901 to 2002/09/01
write sy-datum to gd_date yyyy/mm/dd.</b>
* Converts date from 20020901 to 01.09.02
write sy-datum to gd_date dd/mm/yy.
Using data manipulation techniques
************************************
data: gd_date(8). "field to store output date
* Converts date from 20010901 to 01092001
gd_date(2) = sy-datum+6(2).
gd_date+2(2) = sy-datum+4(2).
gd_date+4(4) = sy-datum(4).
Using Function modules
************************
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.
HOPE THIS SOLVES UR PROBLEM. Reward and close teh thraed if ur problem got solved.
05-17-2006 7:25 AM
Hi Raghu,
Use RP_FORMATING_DATE.
<b>Reward points if it helps.</b>
05-17-2006 7:33 AM
The internal format usually will be in yyyymmdd format..
IN that case, you can use edit mask to print it in yyyy.mm.dd format..
ex:
data: datum(11).
datum = sy-datum.
write:/ date using edit mask '____.__.__'.