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

date and time display

Former Member
0 Likes
3,171

i am printing date from sy-datum and time from sy-uzeit 20070301 at 141726 . Can i change this to print like 03.01.2007 and 14:17:26 . I appreciate your responses.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
2,546

concatenate v_date4(2) '.' v_date6(2) '.' v_date0(4) '.' v_time0(2) ":" v_time2(2) ':' v_time4(2) ':' into v_date1.

Regards,

Santosh

i am printing date from sy-datum and time from sy-uzeit 20070301 at 141726 . Can i change this to print like 03.01.2007 and 14:17:26 . I appreciate your responses.

13 REPLIES 13
Read only

Former Member
0 Likes
2,546

HI Deepthi,

WRITE: sy-datum DD/MM/YYYY,

Regards,

John.

Read only

Former Member
0 Likes
2,546

Hello,

DATA: LV_DATUM(10),
          LV_TIME(8).

write: sy-datum to LV_DATUM,
         sy-uzeit to lv_time.

write: LV_DATUM,LV_TIME

If useful reward.

Vasanth

Read only

Former Member
0 Likes
2,546

You may use these formatting options with WRITE statement:

... DD/MM/YY

... MM/DD/YY

... DD/MM/YYYY

... MM/DD/YYYY

... DDMMYY

... MMDDYY

... YYMMDD

For TIME:

DATA TIME TYPE T VALUE '154633'.

WRITE (8) TIME USING EDIT MASK '__:__:__'. "Output: 15:46:33

Thanks,

Santosh

Message was edited by:

SKJ

Message was edited by:

SKJ

Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
2,546

The WRITE statement should automatically do the formatting. The date formatting will come from your specific user settings, and the time is always in the form HH:MM:SS

Regards,

Rich Heilman

Read only

Former Member
0 Likes
2,546

Hi,

You can change this to User format, use this code.

data: date type sy-datum,
        time type sy-uzeit.

Data: Date1(10)  type c.
data: time1(8) type c

Date = sy-datum.
time - sy-uzeit.

Write: Date to Date1,
          time to TIME1.

Write:/ Date1, Time1.

Regards

Sudheer

Read only

Former Member
0 Likes
2,546

Hi,

Use this CONVERT_DATE_TO_INTERN_FORMAT

or

CONVERT_DATE_TO_EXTERNAL

CONVERT_DATE_TO_INTERNAL

CONVERT_DATE_INPUT

CONVERT_DATE_WITH_THRESHOLD

CONVERT_DATE_BY_PERIOD_INPUT

CONVERT_DATE_BY_PERIOD_OUTPUT

Use any one of this .

Regards,

Sreevani

Read only

Former Member
0 Likes
2,547

concatenate v_date4(2) '.' v_date6(2) '.' v_date0(4) '.' v_time0(2) ":" v_time2(2) ':' v_time4(2) ':' into v_date1.

Regards,

Santosh

Read only

amit_khare
Active Contributor
0 Likes
2,546

Concatenate sy-datum4(2) '.' sy-datum6(2) '.' sy-datum+0(4) into v_date.

Do same for time.

Regards,

Amit

Read only

Former Member
0 Likes
2,546

call the FM MSS_GET_SY_DATE_TIME

Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
2,546

You can try this.



report zrich_0001 .

data: datum(10) type c.

write sy-datum to datum using edit mask '__.__.____' .

write:/ datum.

Regards,

Rich Heilman

Read only

0 Likes
2,546

concatenate sy-uname 'Logged on to' sy-sysid

'on' date 'at' sy-uzeit

into email_data-obj_descr separated by space.

how do i change this statement now .

Read only

0 Likes
2,546

ok got it .. let me try

Read only

0 Likes
2,546

Copy your sy-datum to a variable of length 10 and same for time aswell and then write that variable. The write statement will print it as per your settings made like '.' or '/' or what ever it is set to.