Date and Time functions to UTC time

2 posts, 0 answers
  1. Jerry
    Jerry avatar
    5 posts
    Member since:
    Oct 2015

    Posted 09 Feb 2017 Link to this post

    In the Designing Reports doc, it says:

     Now() Returns the current date and time on the computer processing the report, expressed as the local time.

    I have a server to generate the report,  so the Now() = server local time.   Server can be deployed to anywhere ( UTC offset can be any value)

    I want to show client local time Now() in the report.  How can I implement it? 

  2. Stef
    Stef avatar
    3610 posts

    Posted 13 Feb 2017 Link to this post

    Hi Jerry,

    About dates in Telerik Reporting:
    1. In reports you can use the built-in Today and Now functions, which are evaluated on the server machine where reports are processed and rendered;
    2. When you use the HTML5 Viewer, the user selects local dates which we convert to UTC dates before submitting them to the server.

    Thus to avoid displaying the server's time, you can add an Integer report parameter adding the hours to the Now() value. The parameter's value will be the UTC offset.
    Other approach will be to use a DateTime report parameter instead of Now() in the expression. The parameter's value can be set in the report's constructor or through the client to an adjusted DateTime value.

    We also recommend storing all dates in UTC with offset.

    Telerik by Progress
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Back to Top