문제

I'm trying to convert timezone in javascript from "Asia/Kolkata" to "America/Los_Angeles" but getting error : "Timezone "Asia/Kolkata" is either incorrect, or not loaded in the timezone registry."

following is my code:

<html>
<head>
  <script type="text/javascript" src="includes/javascript/jquery.js"></script>
  <script type="text/javascript" src="includes/javascript/timezone/src/date.js"></script>
</head>
<body>
  <script type="text/javascript">
    $(document).ready(function(){
        alert(new Date);
    timezoneJS.timezone.zoneFileBasePath = '/javascript/timezone/tz';
    timezoneJS.timezone.defaultZoneFile = ['asia', 'backward', 'northamerica'];
    timezoneJS.timezone.loadingScheme = timezoneJS.timezone.loadingSchemes.MANUAL_LOAD;
    timezoneJS.timezone.loadZoneJSONData('/javascript/timezone/tz/all-tz.json', true);
    timezoneJS.timezone.init();
    var dt = new timezoneJS.Date("2014/02/18 16:30:21 +0000", "Asia/Kolkata");
    dt.setTimezone("America/Los_Angeles");
    console.log(dt);
    });
</script>
</body>
</html>

I've no idea what exactly wrong with it.

올바른 솔루션이 없습니다

다른 팁

I am using timezone.js and code is:

var dt = new timezoneJS.Date("2012/04/10 10:10:30 +0000", 'Asia/Kolkata'); dt.setTimezone("America/Los_Angeles");

console.debug(dt);

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top