Shreedhar Kotekar
Shreedhar Kotekar

Reputation: 1114

Displaying Time Zone information in Reporting Service Reports (SQL 2005)

I have a Microsoft SQL 2005, reporting project. I want to display the Current date, time and timezone information on the page header. That is, I want to get a display as below

6/17/2009 12:25:11 PM +05:30

I added a text box to the page header. When set its expression to =Now, used the FormatDateTime function but they all either display only, date or time or date & time but not the timezone.

When I set the Format property of textbox to "o" and I got the following display 2009-06-17T12:37:36.2347500+05:30. This does have the timezone, but date and time info is not very friendly.

Is there anyway I can display the current date time and timezone info the the format (6/17/2009 12:25:11 PM +05:30) I require?

Thanks Shreedhar

Upvotes: 0

Views: 1266

Answers (3)

M.Turrini
M.Turrini

Reputation: 738

Be careful with the format you define "friendly". Since you want to display the timezone I suppose your app has to be used by people living all over the world: for most of them the format "MM/dd/yyyy" is not friendly at all.
Think of a date like "06/10/2009": for English people it's clearly the 10th of June, but for Latin people it will likely be the 6th of October.
The ISO format is not very friendly, I agree, but the informations are displayed in a hierarchical order from the greatest to the smallest. Besides almost nobody uses natively it, and this can be a plus, since everybody will have to understand what it is looking at, without making false assumptions based on his/her locale.

Upvotes: 1

AB.
AB.

Reputation: 282

use DateTime.Now.ToString("MM/dd/yyyy HH:mm:ss tt K")

Upvotes: 2

TheVillageIdiot
TheVillageIdiot

Reputation: 40497

Please use this:

DateTime.Now.ToString("MM/dd/yyyy hh:mm:ss tt K")

Upvotes: 1

Related Questions