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

time change

Former Member
0 Likes
685

hi,

i have a variable which displays the current time .

but i want the o/p time as excatly after 1hr of current time.

how to do that ...

5 REPLIES 5
Read only

former_member329859
Participant
0 Likes
640

Hi

try this,

u can convert all hours in minutes i.e. 1 hr = 60 min.

then add 60 min in that & again divide it by 60 u'll get ur time

Read only

Former Member
0 Likes
640

Add 3600 to the current time.

-Rajat

Read only

Former Member
0 Likes
640

Hi,

Refer the code below:


data : date type sy-uzeit.

date = sy-uzeit.

write : date.

date = date + 3600.

write : date.

Thanks,

Sriram POnna.

Read only

0 Likes
640

Hi,

data: time2 type SYUZEIT.

write:/ SY-UZEIT.

time2 = SY-UZEIT + 3600.

write: / time2.

Thanks,

Nelson

Read only

Former Member
0 Likes
640

Hi,

Use the below FM ISU_DATETIME_ADD_OFFSET as it is efficient even if your date changes when adding 1 hour to time( example: if add 1 hr on 25th september 11:05 PM, then the result would be 26th september 00:05 AM)

data lv_datetime type ISU_DATETIME.

lv_datetime-date = sy-datum. " assign your date variable here
lv_datetime-time = sy-uzeit. " assign your time variable here

WRITE lv_datetime.
CALL FUNCTION 'ISU_DATETIME_ADD_OFFSET'
  EXPORTING
    x_datetime       = lv_datetime
    x_offset         = '3600'
 IMPORTING
   Y_DATETIME       = lv_datetime.

WRITE lv_datetime.

You can get the date and time from lv_datetime-date and lv_datetime-time respectively.

Regards

Karthik D