Application Development 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: 

Date format

Former Member
0 Kudos

Hi,

I want the date and time format as follows

15-SEP-2005 11:33:41

Thanks in advance

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi vj,

1. For date in 15-SEP-2005 format,

just use the FM

CONVERSION_EXIT_SDATE_OUTPUT

2. Time will come in that format,

if u just use WRITE

data : myvar(8) type c.

write mytime into myvar.

regards,

amit m.

12 REPLIES 12

Former Member
0 Kudos

Hi vj,

1. For date in 15-SEP-2005 format,

just use the FM

CONVERSION_EXIT_SDATE_OUTPUT

2. Time will come in that format,

if u just use WRITE

data : myvar(8) type c.

write mytime into myvar.

regards,

amit m.

0 Kudos

<b>1)</b> Have you tried

WRITE SY-DATUM DD/MMM/YYYY.

?

There are various conversion exits you can use, search SE37 with 'CONVERSION_EXIT_DAT_OUTPUT'.

<b>2)</b>

use table t247 with elect logic...

parameters: date like sy-datum.

data: begin of itab occurs 0,

SPRAS type SPRAS,

MNR LIKE T247-MNR,

KTX LIKE T247-KTX,

LTX LIKE T247-LTX,

end of itab.

DATA : month LIKE T247-MNR.

DATA: YEAR(4).

DATA: FINAL(18).

DATA: DAY(2).

DAY = DATE+6(2).

MONTH = DATE+4(2).

YEAR = DATE+0(4).

select SINGLE * from t247 into itab where mnr = month

AND SPRAS = 'E'.

APPEND ITAB.

CONCATENATE DAY ITAB-KTX YEAR INTO FINAL SEPARATED BY '-'.

WRITE: FINAL.

2)

0 Kudos

hi,

try:

REPORT zforum93 .
TABLES t247.
DATA date(20).
DATA dt(20).
DATA time(8).

WRITE sy-datum TO date USING EDIT MASK '__-__ -____'.
WRITE sy-uzeit TO time USING EDIT MASK '__:__:__'.

SELECT SINGLE * FROM  t247
       WHERE  spras  = sy-langu
       AND    mnr    = sy-datum+4(2).

move t247-ktx to date+3(3).
concatenate date time into dt separated by space.
write : / dt.

A.

Message was edited by: Andreas Mann

0 Kudos

Hi,

you can try this way...

data: date type sy-datum, text(20).

date = sy-datum.

CALL FUNCTION 'CONVERSION_EXIT_SDATE_OUTPUT'
  EXPORTING
    INPUT         = date
 IMPORTING
   OUTPUT        = text
          .

<b>translate text using '.-'.</b>
write text.

regards

vijay

sushant_singh
Participant
0 Kudos

go to

system -> user profile -> own data -> then select defaults (tab) . from here u can set the format as u require.

former_member188685
Active Contributor
0 Kudos

hi,

use the fm

CONVERSION_EXIT_SDATE_OUTPUT,

to this fm pass the date as <b>yyyymmdd</b>.and time as

data: time(8).

write sy-uzeit to time.

regards

vijay

Former Member
0 Kudos

TABLES t247.

DATA date(20).

DATA dt(20).

DATA time(8).

try this in report

WRITE sy-datum TO date USING EDIT MASK '__-__ -____'.

WRITE sy-uzeit TO time USING EDIT MASK '__:__:__'.

SELECT SINGLE * FROM t247

WHERE spras = sy-langu

AND mnr = sy-datum+4(2).

move t247-ktx to date+3(3).

concatenate date time into dt separated by space.

write : / dt.

0 Kudos

Hi

If i use this FM CONVERSION_EXIT_SDATE_OUTPUT,

the o/p will be 07.JUL.2006

but i want 15-SEP-2005

not '.' but '-'

Thanks in advance

0 Kudos

Hi again,

1. Simple

2. we can use REPLACE

3. just copy paste

4.

report abc.

data : mydate(11) type c.

parameters : dt type sy-datum default sy-datum.

CALL FUNCTION 'CONVERSION_EXIT_SDATE_OUTPUT'

EXPORTING

INPUT = dt

IMPORTING

OUTPUT = mydate

.

write 😕 mydate.

replace all occurences of '.' in mydate with '-'.

write 😕 mydate.

regards,

amit m.

0 Kudos

Once you have the date in a string,

then do this:

replace all occurances of '.' with '-' in v_date.

Regards,

Ravi

Former Member
0 Kudos

hi,

You Can use following function Module

to convert it into desired format.

HRGPBS_HER_FORMAT_DATE.

regards

vikas

Former Member
0 Kudos

Hi ,

can use the following code :-

data : t_month_names TYPE STANDARD TABLE OF t247,

date type sy-datum,

year(4) type c,

mon(2) type c,

day(2) type c,

w_area like t247,

result(11) type c .

date = sy-datum.

year = date+0(4).

mon = date+4(2).

day = date+6(2).

refresh t_month_names.

clear w_area.

CALL FUNCTION 'MONTH_NAMES_GET'

EXPORTING

language = sy-langu

TABLES

month_names = t_month_names.

loop at t_month_names into w_area.

if w_area-mnr eq mon.

concatenate day '-' w_area-ktx '-' year into result.

endif.

clear w_area.

endloop.

write : result , sy-uzeit.

Hope this solves your problem.

Cheers,

Anirban.