2012 Nov 24 9:18 AM
Hi ABAP Experts,
I want system time . I am using sy-uzeit for getting system time. Its printing like 14:56:42. But I want show as 2.56 P.M . How can i achieve this.
Please Guide me.
Thanks and Regards,
Linganathan.K
2012 Nov 24 9:28 AM
Hi
You can use F.M. HRVE_CONVERT_TIME
Pass time_type = 'A' .
input_time = sy-uzeit.
and you will get your desired result in output_time and output_am_pm.
Hope this helps.
2012 Nov 24 9:40 AM
dear Maverick,
Can you please send any sample code.
Regards,
Linganathan
2012 Nov 24 9:52 AM
DATA: lv_time TYPE sy-uzeit,
lv_am_pm TYPE char2.
lv_time = sy-uzeit.
CALL FUNCTION 'HRVE_CONVERT_TIME'
EXPORTING
type_time = 'A'
input_time = lv_time
* INPUT_AM_PM = 'AM'
IMPORTING
OUTPUT_TIME = lv_time
OUTPUT_AM_PM = lv_am_pm
EXCEPTIONS
PARAMETER_ERROR = 1
OTHERS = 2
.
IF sy-subrc EQ 0.
WRITE:/ lv_time, lv_am_pm.
ENDIF.
You can also make a variable type string and concatenate lv_time and lv_am_pm if you want to use it combined.
2012 Nov 24 9:52 AM
Use FM HRVE_CONVERT_TIME .
CALL FUNCTION 'HRVE_CONVERT_TIME'
EXPORTING
type_time = 'A'
input_time = sy-uzeit
IMPORTING
OUTPUT_TIME = <Time>
OUTPUT_AM_PM = <AM/PM Value>
CONCATENATE the two importing parameter to get the exact value.
2012 Nov 24 10:01 AM
Virtually everything around date or time formatting has been discussed before. Please make sure you look for available information before posting.
Un-marking this as question.
Thomas