Skip to Content
0

Determine if sy-datum variable is summertime or wintertime

Nov 10, 2016 at 09:05 AM

230

avatar image

Hi all,

is there a standard way (fm or method) in SAP to determine if a local variable of type sy-datum is in the date range of summertime or wintertime? I was looking for something that takes in input the local variable date and returns 'Summertime' or 'Wintertime' as output.

Please help.

James

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

4 Answers

Best Answer
Nic Teunckens Nov 10, 2016 at 09:54 AM
1

We've done this via FM "TZON_INTERNAL_TO_IETF" :

  call function 'TZON_INTERNAL_TO_IETF'
    EXPORTING
      if_timezone         = 'CET'
      if_year             = sy-datum(4)
    IMPORTING
      et_ietf_data        = lt_shiftdates
    EXCEPTIONS
      time_zone_not_found = 1
      dst_rule_not_found  = 2
      others              = 3.

The output table should provide the dates by which 'STANDARD' changes to 'DAYLIGHT' by checking the Dates with Prefix 'DTSTART:'.

Hope this helps ...

Nic T.

Show 2 Share
10 |10000 characters needed characters left characters exceeded

Thanks Nic

that was really helpful, I solved my problem.

James

0

No problem, glad I could help.

Please Close the thread if your question is Solved.

0
Sandra Rossi Nov 10, 2016 at 09:29 AM
1

It depends also which time zone is your input date. You have to define a rule (for instance, there's a time zone in the user profile). When you have chosen the right time zone, then you may use CONVERT TIME STAMP (input is a UTC timestamp + a time zone) to get the Daylight Saving Time indicator.

Show 2 Share
10 |10000 characters needed characters left characters exceeded

Hi Sandra,

how can I use CONVERT TIME STAMP to get the Daylight Saving Time indicator? sy-dayst doesn't get flagged after using CONVERT TIME STAMP instruction. So, what else should I use to get that indicator?

Thank you in advance.

0

Hi Sandra,

eventually I was able to use your CONVERT TIME STAMP with DAYLIGHT SAVING TIME.

Thank you!

James

1
Volker Binder Nov 10, 2016 at 09:12 AM
0

there is a systemfield SY-DAYST

Show 1 Share
10 |10000 characters needed characters left characters exceeded

Actually, understanding how SAP calculates sy-dayst (blank or 'X') could help in finding a solution to my problem.

0
Volker Binder Nov 10, 2016 at 09:32 AM
0

if it's Day Light Saving Time the flag is 'X'

if it's not the flag is space.

The flag is set at operating system level.

Share
10 |10000 characters needed characters left characters exceeded