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 Conversion issues

Former Member
0 Likes
1,344

Hi,

I am using the below code for converting date and time to timestamp.

  • To convert time of a zone into GMT time in the form of time stamp

CONVERT DATE p_dat_low TIME p_v_times DAYLIGHT SAVING TIME p_v_dst

INTO TIME STAMP p_v_tst TIME ZONE p_p_t_zone.

in timezone I am passing 'LBANON' i,e for country lebanon. But i am getting error i,e sy-subrc = 12.

Can anyone plz help me how to rectify this

Thanks,

Sakti

6 REPLIES 6
Read only

former_member242255
Active Contributor
0 Likes
972

You can use the Fm 'IB_CONVERT_INTO_TIMESTAMP'

Read only

0 Likes
972

Hi Sravan,

Thanks for your response.

But in this FM there is no parameter to pass 'daylight saving'.

Thanks,

Sakti

Read only

sridhar_meesala
Active Contributor
0 Likes
972

Hi,

Try uing the FM VELO03_CONVERT_INTO_TIMESTAMP to convert to timestamp.

Thanks,

Sri.

Read only

Former Member
0 Likes
972

Hi,

I have written the below code.

CONVERT DATE p_dat_low TIME p_v_times DAYLIGHT SAVING TIME p_v_dst

INTO TIME STAMP p_v_tst TIME ZONE p_p_t_zone.

For some countries it is working for some it is not working.

Can anyone suggest where is the problem.

Thanks,

Sakti

Read only

0 Likes
972

Have you checked the documentation.......


CONVERT DATE dat [TIME tim [DAYLIGHT SAVING TIME dst]] 
        INTO TIME STAMP time_stamp TIME ZONE tz. 

Sy-Subrc = 12: Time specification could not be converted, because dat, tim, or dst contain invalid or inconsistent values.

If dst has a different value or the specified value does not suit the value in tim and dat, the time_stamp remains unchanged and sy-subrc is set to 12

Read only

0 Likes
972

Hi Satyajit,

Thanks for your response.

I am totally agree with you.

can you explain me more details about the issues as i have already mentioned the same syntax working for some countries and not for other.

e;g for Lebanon it is not working. Because i am passing 'LBANON' in timezone . As lebanon is 2 hrs ahead from UTC time, if i passed 'UTC2' in timezone it is working.

Thanks,

Sakti