‎2005 Dec 21 3:15 AM
Dear Friends,
I have the requirement that user will input in screen 12 hours (01:10 PM) format for time rather than 24 hours format (13:10). Similarly, the time mask should be 12 hours fomat than 24 hours.
Any clues with anybody.
Regards,
Deva.
‎2005 Dec 21 4:12 AM
Hi,
Try the FM: <b>HRVE_CONVERT_TIME</b>
TYPE_TIME A ( Use 'B' for the other format)
INPUT_TIME 13:00:00
INPUT_AM_PM AM
Export parameters Value
OUTPUT_TIME 01:00:00
OUTPUT_AM_PM PM
Also Try these sample codes:
data: time type sy-uzeit value '073000'.
data TIMEC(6).
data h1 type P DECIMALS 1.
data h2 type P DECIMALS 1.
data h3 type P DECIMALS 1.
data hours type P DECIMALS 1.
move time to timeC.
MOVE TIMEC(2) TO H1.
MOVE TIMEC+2(2) TO H2.
MOVE TIMEC+4(2) TO H3.
hours = h1 + ( h2 / 60 ) + ( H3 / 3600 ).
write:/ hours.
The below code ignores the seconds. The hours are in 24 hour format.
DATA: v_tims LIKE sy-uzeit,
v_hrs TYPE p decimals 1.
START-OF-SELECTION.
v_tims = sy-uzeit.
v_hrs = v_tims+0(2) + ( v_tims+2(2) / 60 ).
WRITE: v_hrs.
Regards,
Anjali
‎2005 Dec 21 3:58 AM
Well, it sounds like you'll have to have a radio button or checkbox for AM/PM and you'll then either have to convert that to 24 hour time to store on the database or leave it in 12 hour format and also store whether it's AM or PM in a separate field. Is that what you're asking?
rob
‎2005 Dec 21 3:59 AM
Hi,
Use SET command controls the time field format
For details on SET command Click on the below link:
http://dev.mysql.com/doc/maxdb/en/78/ac9b41aa6ca309e10000000a155106/content.htm
Thanks,
Naga
‎2005 Dec 21 4:12 AM
Hi,
Try the FM: <b>HRVE_CONVERT_TIME</b>
TYPE_TIME A ( Use 'B' for the other format)
INPUT_TIME 13:00:00
INPUT_AM_PM AM
Export parameters Value
OUTPUT_TIME 01:00:00
OUTPUT_AM_PM PM
Also Try these sample codes:
data: time type sy-uzeit value '073000'.
data TIMEC(6).
data h1 type P DECIMALS 1.
data h2 type P DECIMALS 1.
data h3 type P DECIMALS 1.
data hours type P DECIMALS 1.
move time to timeC.
MOVE TIMEC(2) TO H1.
MOVE TIMEC+2(2) TO H2.
MOVE TIMEC+4(2) TO H3.
hours = h1 + ( h2 / 60 ) + ( H3 / 3600 ).
write:/ hours.
The below code ignores the seconds. The hours are in 24 hour format.
DATA: v_tims LIKE sy-uzeit,
v_hrs TYPE p decimals 1.
START-OF-SELECTION.
v_tims = sy-uzeit.
v_hrs = v_tims+0(2) + ( v_tims+2(2) / 60 ).
WRITE: v_hrs.
Regards,
Anjali
‎2005 Dec 21 8:01 AM
Dear Anjali,
The FM works fine.
I'll redefine my problem. I want the input in my selection screen in AM/PM format. And print the same in my output (report). This function module HRVE_CONVERT_TIME works fine to print the values but can something be done for the selection screen.
Please help me out.
Regards,
Deva.