Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

urg:reg:date conversion

Former Member
0 Likes
904

how to convert yyyymmdd to dd/mm/yy

hi,

chk this.

HRGPBS_HESA_DATE_FORMAT

Format a date valid for HESA: DD/MM/YYYY

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.

Another FM - CONVERT_DATE_TO_EXTERNAL

Rgds

Anver

8 REPLIES 8
Read only

Former Member
0 Likes
882

concatenate sy-datum0(4) '/' sy-datum4(2) '/' sy-datum+6(2) into g_dat.

Read only

Former Member
0 Likes
882

data : date type sy-datum.

data : date1(10) type c.

date = sy-datum.

concatenate date6(2) '/' date 4(2) '/' date2(2) into date1.

Now date1 caontains the date in ur required format.

Regards,

Sujatha.

Message was edited by:

Sujatha Reddy

Read only

anversha_s
Active Contributor
0 Likes
882

hi,

chk this.

HRGPBS_HESA_DATE_FORMAT

Format a date valid for HESA: DD/MM/YYYY

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.

Another FM - CONVERT_DATE_TO_EXTERNAL

Rgds

Anver

Read only

Former Member
0 Likes
882

Hi,

Use the concatenation

data g_date(8).

concatenate

sy-datum6(2) '/' sy-datum4(2) '/' sy-datum+2(2) to g_date.

reward if useful

regards,

ANJI

Read only

Former Member
0 Likes
882

hi Varun,

try the following logic:


data:
   date1 type sy-datum,
   date2(10).

data1 = sy-datum.
concatenate date1+6(2) date1+4(2) date1+0(4) into date2
separated by '/'.

write: date1, / date2.

Hope this helps,

Sajan Joseph.

Read only

Former Member
0 Likes
882

TRY THIS

DATA : V_CHAR LIKE SY-DATUM VALUE '20070410'.

DATA : YEAR(2),

MON(2),

DAY(2),

DATE(8).

YEAR = V_CHAR+2(2).

MON = V_CHAR+4(2).

DAY = V_CHAR+6(2).

CONCATENATE DAY MON YEAR INTO DATE SEPARATED BY '/'.

WRITE : / DATE.

Read only

Former Member
0 Likes
882

Hi Varun,

Check this info.

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

Read only

anversha_s
Active Contributor
0 Likes
882

Dear Varun,

Please close all your open threads if u got the correct solution. Otherwise revert back.

Regards

Anversha