‎2007 Apr 11 11:25 AM
how to convert yyyymmdd to dd/mm/yy only using function module only without using offset
‎2007 Apr 11 11:27 AM
Hi
DATA: e_date(10) type c VALUE '2/2/2006',
i_date(10).
CALL FUNCTION 'CONVERT_DATE_TO_INTERNAL'
EXPORTING
date_external = e_date
IMPORTING
date_internal = i_date
EXCEPTIONS
date_external_is_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.
WRITE : / 'CONVERT_DATE_TO_INTERNAL',
/ 'My Date:' , e_date ,
'Conv Date:', i_date.
skip 2.
CALL FUNCTION 'CONVERT_DATE_TO_EXTERNAL'
EXPORTING
DATE_INTERNAL = sy-datum
IMPORTING
DATE_EXTERNAL = e_date
EXCEPTIONS
DATE_INTERNAL_IS_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.
WRITE : / 'CONVERT_DATE_TO_EXTERNAL',
/ 'My Date:' , sy-datum,
'Conv Date:', e_date.
Hope this helps
Regds
Seema
‎2007 Apr 11 11:28 AM
Hi,
Only using offset.
data: lv_date(8) type c.
lv_date = sy-datum.
CONCATENATE lv_date6(2) '/' lv_date4(2) lv_date+2(2) INTO itab-date.
regards
Kannaiah
‎2007 Apr 11 11:29 AM
Creatd a 10 Character variable (eq : W_date) , then use Write to statement.
Write SY-datum to W_date.
Hope this helps,
Regards,
Senthil N S
‎2007 Apr 11 11:30 AM
hi,
just use this.
data:date_form type CHAR10.
call function 'HRGPBS_HESA_DATE_FORMAT'
exporting
P_DATE = sy-datum
importing
DATESTRING = date_form
exceptions
others = 1.
write : date_form.Rgds
Anver
‎2007 Apr 11 11:30 AM
Hi,
SimpleDateFormat fmtDatePlain = new SimpleDateFormat("dd/mm/yyyy");
String formattedDate = fmtDatePlain.format(yourdate)
the output is string
or
use write statement
write: sy_datum to v_datum dd/mm/yy.
Plz go through the following links .
I hope it will tell you all the things related to Date & time.
http://help.sap.com/saphelp_nw2004s/helpdata/en/96/aeb14000a6c84ee10000000a1550b0/frameset.htm
http://help.sap.com/saphelp_nw2004s/helpdata/en/96/aeb14000a6c84ee10000000a1550b0/frameset.htm
http://help.sap.com/saphelp_nw2004s/helpdata/en/42/c87909c84d136de10000000a1553f7/frameset.htm
regards
navjot
‎2007 Apr 11 11:31 AM
hi Avrun
use function module <b> CONVERSION_EXIT_PDATE_OUTPUT </b>
sample code:
data:date_form(10).
call function 'CONVERSION_EXIT_PDATE_OUTPUT'
exporting
input = sy-datum
importing
output = date_form
exceptions
others = 1.
write : date_form.
hope this helps,
Sajan Joseph.
‎2007 Apr 11 11:33 AM
‎2007 Apr 11 11:33 AM
Hi,
You can use WRITE FORMATING.
Here the sample code:
DATA: BEGDA TYPE TEXT10,
ENDDA TYPE SY-DATUM.
WRITE SY-DATUM TO BEGDA DD/MM/YY .
WRITE SY-DATUM TO ENDDA DD/MM/YY .
And of course you can use other format, like:
... DD/MM/YY
... MM/DD/YY
... DD/MM/YYYY
... MM/DD/YYYY
... DDMMYY
... MMDDYY
... YYMMDD
Message was edited by:
veereshbabu ponnada
‎2007 Apr 11 11:38 AM
Hi Varun,
Use function module CONVERT_DATE_TO_EXTERNAL. This will convert the date to the user specific format. So if your user specific format is mm/dd/yyyy, then this is all you need.
Hope this resolves your query.
Reward all the helpful answers.
Regards
‎2007 Apr 11 11:38 AM
Hi Varun,
Have you checked Anversha's solution?? It was mentioned in your earlier thread also . pls check your answers before posting duplicate questions, Heres anvers solution
REPORT ZTEST.
DATA:DATE_FORM TYPE CHAR10.
CALL FUNCTION 'HRGPBS_HESA_DATE_FORMAT'
EXPORTING
P_DATE = SY-DATUM
IMPORTING
DATESTRING = DATE_FORM
EXCEPTIONS
OTHERS = 1.
WRITE : DATE_FORM.
‎2007 Apr 11 11:44 AM
Hi,
Use the following function module
<b>SLS_MISC_CONVERT_TO_DATE</b>
Regards,
Sandhya