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

Problem in time comparison.

Former Member
0 Likes
718

Hi All,

I have one problem in time comparison.I am comparing time between two variables.In onr variable time has come from database table in 1200000 pattern i.e without colon and spaces.

And in other variable it is 12:00:00 format.

Now i have to format this 12:00:00 variable so that it comes like 120000.

Please suggest ways to do it.

Thanks in advance,

saket

5 REPLIES 5
Read only

Former Member
0 Likes
696

Hello,


 TRANSLATE v_time USING ': '.
  CONDENSE v_time NO-GAPS.

Regards.

Read only

naimesh_patel
Active Contributor
0 Likes
696

You can try like this:


data: l_time(8) type c.

l_time = '11:55:12'.

replace all occurrences of ':' in l_time with ' '.
condense l_time.
write: l_time.

Regards,

Naimesh Patel

Read only

Former Member
0 Likes
696

Hi,

Try this code:

REPORT z_demo_jg1 LINE-COUNT 10(2) NO STANDARD PAGE HEADING.

data: l_time(6) type n.

l_time = '12:00:00'.

write: l_time.

Read only

Former Member
0 Likes
696

Check this code:


Report ztest.

parameters:
p_time1 type tims,          " Eg  12:00:22
p_time2 type c length 6.  " Eg  112023

data:
v_temp type tims,
v_difference type tims.

v_temp = p_time2. 
v_difference = p_time1 - v_temp.

write: /1 v_difference.

output :


00:39:59 

Read only

Former Member
0 Likes
696

Thanks a lot