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

How to convert simulation time into date format.

Former Member
0 Likes
554

Hi All,

I am writing a simulation program in ABAP. output of my simulation is interms of time. for example while simulating i am considering 1 day= 1sec, and when simulation begins T=0, after completion of simulation i am holding a value , say 75 sec),

now i need to convert this 75 seconds time into a date. taking intial T= 0 as current date , and finding the final date i.e after 75 seconds, considering 5 day week .

i searched for this in the forum and couldn't find any.

Anysort of help is appreciated.

Thanks in Advance.

Sharatchandra

Hi All,

I am writing a simulation program in ABAP. output of my simulation is interms of time. for example while simulating i am considering 1 day= 1sec, and when simulation begins T=0, after completion of simulation i am holding a value , say 75 sec),

now i need to convert this 75 seconds time into a date. taking intial T= 0 as current date , and finding the final date i.e after 75 seconds, considering 5 day week .

i searched for this in the forum and couldn't find any.

Anysort of help is appreciated.

Thanks in Advance.

Sharatchandra

2 REPLIES 2
Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
510

If you wanted to count calendar days, you could simpley add the 75 to current date, this would give you the date 75 dates from now.

data: 75_datum type sy-datum.

75_datum = sy-datum + 75.

But since you want to skip weekends, you will need to count against a calendar id.



    call function 'END_TIME_DETERMINE'
         exporting
              duration                   = number_of_days
              unit                       = ' '
              factory_calendar           = t001w-fabkl
         importing
              end_date                   = newdate  "(ANSWER)
         exceptions
              factory_calendar_not_found = 1
              date_out_of_calendar_range = 2
              date_not_valid             = 3
              unit_conversion_error      = 4
              si_unit_missing            = 5
              parameters_no_valid        = 6
              others                     = 7.

Regards,

Rich Heilman

Read only

Former Member
0 Likes
510

How about:

DATA: secs TYPE i VALUE '75',
      wk_ti TYPE i,
      new_date LIKE sy-datum.

wk_ti = FLOOR( secs * 7 / 5 ).

new_date = sy-datum + wk_ti.

Rob