开发者

Report Builder 2.0 : How to get the correct timezone info

开发者 https://www.devze.com 2022-12-29 13:55 出处:网络
I am developing report using SQL Report Builder 2.0, In this I am passing the timezone offset value as a parameter (-04:00). Using \"TimeZoneInfo\" I am getting all the timezones available from the sy

I am developing report using SQL Report Builder 2.0, In this I am passing the timezone offset value as a parameter (-04:00). Using "TimeZoneInfo" I am getting all the timezones available from the system. But I am checking the timezone with the offset value, so from the list available I can only get the first timezone object.

Is there any other ways to get a specific TimezoneInfo from开发者_JAVA技巧 the system.

Thanks, Veera


This will return the Timezone offset. System.TimeZone.CurrentTimeZone.GetUtcOffset(now())

This will return the Local time. System.TimeZone.CurrentTimeZone.ToLocalTime(now())

This will display the time zone name System.TimeZone.CurrentTimeZone.StandardName

When running the report on the server, it will show the Server's timezone. One quick way to deal with that is to just show the time & the timezone name.

If you really must show each user their local time, you should probably store the UTC offset against one of the geography tables in your database i.e. office or location. You could also store it against user names (User ID is a global variable available in SSRS) but that would be more maintenance.

0

精彩评论

暂无评论...
验证码 换一张
取 消