02-17-2014 10:12 AM
Hello fellow SDNers,
I am getting the DST timestamp (-1 hrs) when i try to create the timestamp.
This is the code that i have written -
Debugging session looks like this -
SAP documentation on CONVERT INTO TIMESTAMP says & i quote -
If the addition DAYLIGHT SAVING TIME is not specified, then the value of dst is set to "X" implicitly if the data in tim and dat is in summer time and is set to " " for data in winter time.
Refer. - ABAP Keyword Documentation
Am i missing something?
BR,
Suhas
02-17-2014 6:55 PM
Hi Suhas
The output is correct.
The statement converts your date,time,timezone combination to system timestamp (UTC always).
I think you just want to get output as 20140217110409, the literal combination of datlo and timlo.
In this case you can "lie" to the statement, saying that timezone is UTC. As a result, UTC to UTC conversion would give you unchanged datetime.
Let me know if i understood the requirement incorrectly.
02-17-2014 10:58 AM
Hi Suhas
I tried one more thing apart from this. I create a local variable and give it a summer date. Now the timestamp contains 2 hours less.
So for winter for me it is subtracting one hour and for summer two hours without daylight addition.
Nabheet
02-17-2014 11:11 AM
So for winter for me it is subtracting one hour and for summer two hours without daylight addition.
I think you meant the other way round, DST is active in summer & not in winters
02-17-2014 10:59 AM
02-17-2014 11:08 AM
DEBOPRIYO MALLICK wrote:
Check the timezone settings in tcode STZBC
I had already done that before posting, sorry for not mentioning that in my post.
Imo no sane person would mess with these anyway.
BR,
Suhas
02-17-2014 11:12 AM
Yes you are right what if we use sy-uzeit in place of local time?
02-17-2014 12:21 PM
Doesn't help either
I never thought about the difference between System & User Timezones, but yes in my case both are same.
Since in my case the user TZ = system TZ.
BR,
Suhas
02-17-2014 6:55 PM
Hi Suhas
The output is correct.
The statement converts your date,time,timezone combination to system timestamp (UTC always).
I think you just want to get output as 20140217110409, the literal combination of datlo and timlo.
In this case you can "lie" to the statement, saying that timezone is UTC. As a result, UTC to UTC conversion would give you unchanged datetime.
Let me know if i understood the requirement incorrectly.
02-17-2014 8:19 PM
The statement converts your date,time,timezone combination to system timestamp (UTC always).
My bad - should have read the SAP documentation thoroughly (ABAP Keyword Documentation).
Time stamps in the ABAP runtime environment are POSIX time stamps independent of time zone.
In this case you can "lie" to the statement, saying that timezone is UTC.
I don't need a workaround. I just wanted to know why did the statement always return UTC timestamp irrespective of the TZ (and the DST settings)
I don't need the CONVERT INTO TIMESTAMP as well, i'll use GET TIMESTAMP. The reason i got confused was that the documentation of GET TIMESTAMP clearly states that it will generate UTC timestamp, but that of CONVERT INTO TIMESTAMP doesn't
So i assumed that the timestamps will be created in the TZ of the AppServer .
Thanks anyway.
BR,
Suhas
Note to me - When in doubt RTFM, always!