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

Timestamp function module

Former Member
0 Likes
4,193

Hi,

Is there a FM that will give the time difference between two timezones and also would give a sign as plus if the difference is to be added or minus if that difference is to be subtracted respectively.

4 REPLIES 4
Read only

Former Member
0 Likes
1,822

Hi Amber,

I think there is no such function modules as per me.

But u can use these function module to create timestamp to date & time and date & Time to timestamp.

1.     B_CONVERT_INTO_TIMESTAMP' or

2.     IB_CONVERT_FROM_TIMESTAMP'

Use function module 1 two times for two different time zones and calculate it later as below

For Example:-

Data:

     time_diff type t.

* The following function module is used to convert the

* time and date into GMT timestamp

CALL FUNCTION 'IB_CONVERT_INTO_TIMESTAMP'

  EXPORTING

    i_datlo           = sy-datum

    i_timlo           = sy-uzeit

    I_TZONE           = 'INDIA'

IMPORTING

   E_TIMESTAMP       = timestamp.

* The following function module is used to convert the

* time and date into GMT timestamp

CALL FUNCTION 'IB_CONVERT_INTO_TIMESTAMP'

  EXPORTING

    i_datlo           = sy-datum

    i_timlo           = sy-uzeit

    I_TZONE           = 'U.K'

IMPORTING

   E_TIMESTAMP       = timestamp1.

time_diff = timestamp - timestamp1.

so u can have time difference between INDIA and U.K timezones

Regards,

Vineesh.B

Read only

RaymondGiuseppi
Active Contributor
0 Likes
1,822

Or try to look at class CL_ABAP_TSTMP methods for recent versions of ECC.

Regards,

Raymond

Read only

0 Likes
1,822

Hi,

See whether this helps.

Try function module  /OSP/TIMEZONE_RULE.

This will give you the +/- value you are expecting in return parameter ES_TTZZ-ZONEDESC. But it will give you the difference with respect to UTC. You may have to call this function module again with the second time zone & calculate it.

With regards,

Gokul

Read only

0 Likes
1,822

Or may be if /OSP function modules are not available in your system,  try function module TZON_GET_DATA or TZON_GET_OFFSET or for that matter, you can go through function group TZ_UTIL to check all the available function modules related to this.

Regards,

Gokul