here i am giving my code and what happen.
when i am passing timezone id to .net time zone that works the code as below
var zoneId = "India Standard Time";
var zone = TimeZoneInfo.FindSystemTimeZoneById(zoneId);
var now = TimeZoneInfo.ConvertTimeFromUtc(DateTime.UtcNow, zone);
string xx1 = now.ToLongTimeString();
when i am passing the same time zone id India Standard Time to noda time library then i am getting error "Time zone India Standard Time is unknown to source TZDB: 2014e (mapping: 9723)"
my code as follows for noda time
var zoneId = "India Standard Time";
DateTimeZone _zone = DateTimeZoneProviders.Tzdb[zoneId];
ZonedDateTime _now = SystemClock.Instance.Now.InZone(_zone);
string xx= now.ToLongTimeString();
just tell me how to pass timezone to noda library for India Standard Time or GMT Standard Time
thanks
If you want to pass a BCL time zone to Noda Time, you just need to use the BCL provider:
This will find the relevant
TimeZoneInfo
, extract its adjustment rules, and convert that into a Noda Time representation. You can then use it just like any otherDateTimeZone
.Note that these time zone IDs are Windows-specific. If you can uses the IANA (TZDB) time zone IDs instead, that would generally make your data more portable to other systems.
As the error message says, the string you supplied is not in the tzdb (Olson database). There is a list of zones on Wikipedia: Indian Standard Time is "Asia/Kolkata". Try that as your zone string.
"Etc/GMT" is the string for GMT which wiki says is a shortcut to the timezone string "UTC".