this js code return timezone of the client pc.
<script type="text/javascript">
$(document).ready(function () {
$("#btnGo").click(function () {
var objdatetime = new Date();
var timezone = objdatetime.toTimeString();
var tzstr = timezone.split("(");
var timezoneid = tzstr[1].toString().replace(")", "");
alert(timezoneid);
return false;
});
});
</script>
the above js code return timezone id like "India Standard Time" or "GMT Standard Time"
when i feed those timezone to noda library like this way
var zoneId = "India Standard Time";
DateTimeZone _zone = DateTimeZoneProviders.Tzdb[zoneId];
ZonedDateTime _now = SystemClock.Instance.Now.InZone(_zone);
string xx= now.ToLongTimeString();
then i got error "Time zone India Standard Time is unknown to source TZDB: 2014e (mapping: 9723)"
people said that we should pass the timezone id like this way "Asia/Kolkata" or "Etc/GMT" to Noda Library then it may work but browser return timezone id like this way "India Standard Time" or "GMT Standard Time" by calling the above js code.
so get a js code which will return timezone id in such a way as a result Noda library can parse and return current date and time as per the specified timezone id. thanks