‎2009 Mar 23 6:42 AM
Hi Friends,
I have a small problem in converting time..
Actually In my program i am getting time like this ' 080000 ' but that should be converted to 8.00 hrs
if i give time is ' 085215 ' means 8 hrs 52 min 15 sec so...it should be changes to 8.52.15
Is there any function module is change this format..pls tell me
thanks,
laxmi
‎2009 Mar 23 6:48 AM
Hi Laxmi,
Search SCN before posting.
Use CONVERT_TIME_INPUT
Regards,
Nitin.
‎2009 Mar 23 6:51 AM
Hi,
why don't use this small piece of code instead of going for the function module.
DATA:
t TYPE sy-uzeit VALUE '080000',
time TYPE char8.
*t = sy-uzeit.
WRITE t TO time.
WRITE:/ time.
IF t+2(4) = 0.
WRITE:/ t+0(4), 'Hrs'.
ENDIF.else
you can go for the function module CONVERT_TIME_INPUT
thanks
sarves
‎2009 Mar 23 7:01 AM
Hi Friends,
thanks for your quick response...
but here i need to get time like this 8.52.25 not like 08:52:15 ...so how can i achive this.
Thanks,
Laxmi.
‎2009 Mar 23 7:07 AM
Hi Laxmi,
After getting the time in this pattern, you can replace ':' by '.'.
Use:
Replace all occurrences of ':' in date with '.'.
here date is a variable having value in 08:00:00 pattern.
Regards,
Nitin.
‎2009 Mar 23 7:00 AM
Hi,
it can be acheived by writing a single write:
Eg:
DATA TIME TYPE T VALUE '154633'.
WRITE (8) TIME USING EDIT MASK '__:__:__'. "Output: 15:46:33
if you want with dots, then replace dots by colon in write iteself...
WRITE (8) TIME USING EDIT MASK '__.__.__'. "Output: 15.46.33
it will fullfill ur requirement...
Hope it helps!!
Regards,
Pavan
Edited by: vishnu Pavan on Mar 23, 2009 8:16 AM
Edited by: vishnu Pavan on Mar 23, 2009 8:17 AM
‎2009 Mar 23 7:50 AM
Hi Friends,
thank you for your reply.
But my problem is some times i am getting like this 08.52.15 here i need to remove 0 .
if i get like this 10.52.15 that should be same means if i get leading 0 then i want to remove.
How can i do this...
Thanks,
Laxmi
‎2009 Mar 23 8:04 AM
Hi,
DATA: lv_string type string value '08.50.15'.
IF lv_string+0(1) CO '0'.
lv_string = lv_string+1(7).
write lv_string.
ENDIF.Regards,
Sesh
‎2009 Mar 23 8:13 AM
Hi Laxmi,
Use the following code:
IF date+0(1) = '0'.
date = date+1(7).
ENDIF.
Regards,
Nitin.
‎2009 Mar 23 7:09 AM
‎2009 Mar 23 7:14 AM
Hi,
here is the piece of code..to convert time in the format u need ...()
data : time1 like sy-uzeit.
time1 = '123612'.
DATA : lv_timestamp1 TYPE tzntstmps.
break devuser.
CONVERT TIME time1
INTO TIME STAMP lv_timestamp1 TIME ZONE sy-zonlo.
write lv_timestamp1.
i hope u will get some help...
Regards
Ashu Singh
‎2009 Mar 23 10:31 AM
Hi,
The solution is very simple. You have to use EDIT MASK with write statement for desired time format :--
Example suggest you more :--
data: Time(6) value '123045',Time1(4) value '1230'.
WRITE: /(8) TIME USING EDIT MASK '__.__.__'.
WRITE: /(8) TIME1 USING EDIT MASK '__.__'.
The USING EDIT MASK extension will make your desired time format.
‎2009 Mar 23 10:31 AM