how to display report on client side with converted utc datetime to local time zone ?

  • Hello,

    I stored utc datetime in my Database but want to display on the report the time converted to local time.

    all solutions that I have tested ended with the Server local time.

    I have users all over the world so I need something dynamic and not hardcoded

    I have created a function GetTimeZone() that return me the locale time zone

    and affect my default value parameter (Code.GetTimeZone() ) with this value.

    But this value is defininetly the server local time zone.

    In the preview it works fine but as soon as I deploy the report it's ended with Server local time zone.

    here is the function that I use to get the local time zone:

    Function GetTimeZone() As Integer

    GetTimeZone = System.TimeZone.CurrentTimeZone.GetUtcOffset(System.DateTime.Now).Hours

    End Function

    Do you know a way to display in the report utc datetime converted to local time zone ?

    Thanks for your help

  • I found this post on Microsoft side but that not solved my issue

    http://social.msdn.microsoft.com/Forums/en-US/sqlreportingservices/thread/500448a3-bf58-44ab-8572-81becd67d8b8/

    Any idea ?

  • Try using NOW()

  • unfortunatelly Now() function is not working and I still get the Server time zone

  • Reporting services can't do what you're asking it to do, because you're asking it to get information from the client PC. The only way to do that is to develop a webpage instead, and use client-side JavaScript. I'd be happy to be proven wrong, but the only alternative to a webpage that I can see is to have the user select their Time Zone as a parameter.

    Steve

    (aka smunson)

    :):):)

    Steve (aka sgmunson) 🙂 🙂 🙂
    Rent Servers for Income (picks and shovels strategy)

  • This is solution at the back end within SQL DB and not at the rendering Report

    Adding the time Zone to the table and resolving it at the stored proc or Query is what we did when we implemented a global report solution for USNA, EMEA and AP.

    Time zone was a column in the table. And the query calculated the off-set using this column.

    The report just rendered the correct time zone.

    Not sure, at this stage you would have the ability to add a Time Zone column to your DB.

    View Siva Gurusamy's profile on LinkedIn

    "Software changes. This is a rather obvious statement, but it is a fact that must be ever present in the minds of developers and architects. Although we tend to think of software development as chiefly an engineering exercise, the analogy breaks down very quickly. When was the last time someone asked the designers of the Empire State building to add ten new floors at the bottom, put a pool on the top, and have all of this done before Monday morning? " : Doug Purdy, Microsoft Corporation

  • However, keep in mind that adding the time zone to the DB means having to gather it from the user at SOME point, and it may already be too late for that, given that this poster is seeking to get it at report time. This also brings up the issue of dealing with daylight savings time as well as the actual meaning of the date-time value that was stored. Gathering it at report time implies that the information stored in the field is in some way isolated from the user's specific time zone.

    Steve

    (aka smunson)

    :):):)

    Steve (aka sgmunson) 🙂 🙂 🙂
    Rent Servers for Income (picks and shovels strategy)

  • Thanks for your support

    I already have added drop down list with Time zone parameter but I wanted to find out a better solution that automatically select the client time zone and adapt time to their local time.

    I can add a time zone column on the DB but that don't solve my Issue as far I as don't know who request the data.

    The only way will be to provide the client time zone to the db server when the user click on the 'View report' but I don't know how to do that.

  • Seems to me an ASP.NET webpage would be a relatively easy solution. ASP.NET webpages can contain a nearly identical report that you've generated in RS, and you could easily recreate it in Visual Studio for deployment. That way, you can use client-side JavaScript to determine the time-zone offset, and format accordingly by using that code to supply your time zone parameter value.

    Steve

    (aka smunson)

    :):):)

    olivier.ferran (2/9/2009)


    Thanks for your support

    I already have added drop down list with Time zone parameter but I wanted to find out a better solution that automatically select the client time zone and adapt time to their local time.

    I can add a time zone column on the DB but that don't solve my Issue as far I as don't know who request the data.

    The only way will be to provide the client time zone to the db server when the user click on the 'View report' but I don't know how to do that.

    Steve (aka sgmunson) 🙂 🙂 🙂
    Rent Servers for Income (picks and shovels strategy)

  • [font="Verdana"]Have you tried this?

    In the report properties, set the language to "=User!Language". That will change the display format for dates to what the user expects. I'm not exactly sure what the properties of the language are, but you may be able to look it up and see if there's something that allows you to determine the time zone.

    [/font]

Viewing 10 posts - 1 through 9 (of 9 total)

You must be logged in to reply to this topic. Login to reply