SAP Knowledge Base Article - Public

1698610 - How to use the ShiftDateTime function in Crystal Reports?

Symptom

  • How to display date and time based on the time zone on a report?
  • How to use the ShiftDateTime function in a formula in Crystal Reports, and in Crystal Reports for Enterprise?

Environment

  • SAP Crystal Reports 2013
  • SAP Crystal Reports 2016
  • SAP Crystal Reports 2020
        
  • SAP Crystal Reports for Enterprise 4.1
  • SAP Crystal Reports for Enterprise 4.2
  • SAP Crystal Reports for Enterprise 4.3

Resolution

  • The function: ShiftDateTime, shifts a Date Time value from one time zone to another time zone.
          
  • ShiftDateTime have 3 arguments:
    • Input Date Time value.
    • Input Time Zone.
    • Time Zone to which the input Date Time value is to be shifted to.
          
  • Example: If we create a formula using the function: ShiftDateTime, as followed:
          
         ShiftDateTime (DateTime (2000, 1, 1, 12, 0, 0), "EST,300,EDT", "PST,480,PDT")
      
    In the above example, noon Eastern Daylight Time is shifted to 9 am Pacific Daylight Time, therefore the date time returned will be:
      
         1/1/2000 9:00:00 AM
           
       
  • Despite the function ShiftDateTime is relatively simple and uses only 3 arguments, the input time zone and the destination time zone arguments can have lots of details, and therefore can be complex. To help explain what are all the detailed information the time zone argument uses, we will use the following picture to illustrate how the formula works using the following example:
      
        Shiftdatetime ( {?DateTime} , "PST,480,PDT,-60;3.2.0/02:00,11.1.0/02:00" , "WEurope ST,-60,WEuropeDT,-60;3.5.0/02:00,10.5.0/02:00" )
          
    and what is the meaning of each and every value used in the function.
     
    ShiftDateTime.png

Keywords

KBA , BI-RA-CR , Crystal Reports designer or Business View Manager , How To

Product

SAP Crystal Reports 2013 ; SAP Crystal Reports 2016 ; SAP Crystal Reports 2020