Application Development 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: 

Determine if sy-datum variable is summertime or wintertime

former_member244738
Participant
0 Kudos

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

1 ACCEPTED SOLUTION

NTeunckens
Active Contributor

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.

9 REPLIES 9

former_member226519
Active Contributor

there is a systemfield SY-DAYST

0 Kudos

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

Sandra_Rossi
Active Contributor

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.

0 Kudos

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.

Hi Sandra,

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

Thank you!

James

former_member226519
Active Contributor
0 Kudos

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.

NTeunckens
Active Contributor

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.

0 Kudos

Thanks Nic

that was really helpful, I solved my problem.

James

0 Kudos

No problem, glad I could help.

Please Close the thread if your question is Solved.