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 2008
  • SAP Crystal Reports 2011
  • SAP Crystal Reports 2013
  • SAP Crystal Reports 2016
        
  • SAP Crystal Reports for Enterprise 4.0
  • SAP Crystal Reports for Enterprise 4.1
  • SAP Crystal Reports for Enterprise 4.2

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 BusinessViews Manager , How To

Product

Crystal Reports 2008 V1 ; SAP Crystal Reports 2011 ; SAP Crystal Reports 2013 ; SAP Crystal Reports 2016