Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeDevelopment and...Development and...DNN Platform (o...DNN Platform (o...TimeZone questionTimeZone question
Previous
 
Next
New Post
4/20/2010 2:14 PM
 

I have the need to display a users timezone in a module I'm creating.  It will just be a label saying Selected Timezone = Pacific.  Of course Pacific would be the text for that specific time zone which is set in Admin->Languages->TimeZone Editor (or Timezones.xml in the App_GlobalResources file).

My problem is I pull the timezone from the users profile:

UserInfo.Profile.TimeZone

This gets me what looks like the offset in minutes, ie -480 for Pacific Time.  How can I take this value -480 and grab the actual name of the timezone?  I did find the timezone control from DNN so I could use the dropdown.  But it seems silly to display a dropdown when I just want to display the name.

 
New Post
4/20/2010 3:13 PM
 

There is a method in Localization called GetTimeZones which returns a NameValueCollection where the value is the offset (eg -480 for PST) and the key is the name.

As the data is the reverse of what you need - you cannot do a direct lookup.  You will need to iterate over the collection and find the name for the entry that has the value -480.

I would create a helper function that passes in the value and returns the name.


Charles Nurse
Chief Architect
Evoq Content Team Lead,
DNN Corp.

Want to contribute to the Platform project? - See here
MVP (ASP.NET) and
ASPInsiders Member
View my profile on LinkedIn
 
New Post
4/20/2010 4:33 PM
 

Thanks for the help Charles.  That function call pointed me in the right direction.  I was able to write a simple function that takes in the desired off-set and give me the name.  It will most likely always be the user's timezone, but no sense in tieing myself down to just retrieving that value. 

Thanks again.

 
Previous
 
Next
HomeHomeDevelopment and...Development and...DNN Platform (o...DNN Platform (o...TimeZone questionTimeZone question


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out