Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 1065

Re: Difference Between 2 Timestampl's

$
0
0

I would add a pinch of NORMALIZE to the mix -

 

DATA:    ts1    TYPE string VALUE `201605181502031234567`,    ts2    TYPE string VALUE `200905171602031269504`.  DATA(len1) = strlen( ts1 ) - 7.  DATA(len2) = strlen( ts2 ) - 7.  ts1 = ts1+0(len1) && '.' && ts1+len1.  ts2 = ts2+0(len2) && '.' && ts2+len2.  TRY.      cl_demo_output=>display_data(        EXPORTING          value =  cl_abap_tstmp=>subtract(                       tstmp1  = CONV tzntstmpl( cl_abap_tstmp=>normalize( CONV tzntstmpl( ts1 ) ) )                       tstmp2  = CONV tzntstmpl( cl_abap_tstmp=>normalize( CONV tzntstmpl( ts2 ) ) )                   )          name  = |Long-Timestamp Difference|    " Name      ).    CATCH cx_parameter_invalid_range INTO DATA(range_error).    "      MESSAGE range_error TYPE 'E'.    CATCH cx_parameter_invalid_type INTO DATA(type_error).    "      MESSAGE type_error TYPE 'E'.  ENDTRY.

Viewing all articles
Browse latest Browse all 1065

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>