stuartf
stuartf

Reputation: 658

Storing User Time Zone in Amazon SimpleDB

I'm looking to store some information about the the timezone that the user is in. However, i'm not sure what the best practice is to store the timezone in the database as, I'm using Amazon SimpleDB so the type will be of a string. Is there a easy way to store this and reuse TimeZone or TimeZoneInfo that is provided within the .net framework?

Thanks

Upvotes: 1

Views: 236

Answers (1)

user726024
user726024

Reputation:

Hey, you can store time zone id as string and then when reading value from SimpleDB use TimeZoneInfo.FindSystemTimeZoneById method to get CLR instance.

// Id for storage in SimpleDB.
var exampleTimeZone = TimeZoneInfo.GetSystemTimeZones()[0].Id;
// CLR instance to use in .NET from stored Id.
var timeZoneInstance = TimeZoneInfo.FindSystemTimeZoneById(exampleTimeZone);

Upvotes: 3

Related Questions