javascript 按国家/地区代码设置默认时区
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了javascript 按国家/地区代码设置默认时区相关的知识,希望对你有一定的参考价值。
/* Script to set default time zone */
var gr = new GlideRecord("sys_user");
gr.addQuery('email', 'amrik.singh@uk.fujitsu.com'); //TEST
gr.addEncodedQuery("active=true^u_person_type=Employee^countryINDK,EE,FR,DE,PT,FI,IT,IE,GB,PL,ES,NO,SE,TR^time_zone=");
//gr.addQuery("u_country","");
//gr.setLimit(25);
gr.query();
while (gr.next()) {
switch (gr.country.toString()){
case "GB":
gr.time_zone = "GMT";
break;
case "IE":
gr.time_zone = "GMT";
break;
//Poland
case "PL":
gr.time_zone = "Europe/Warsaw";
break;
//Finland
case "FI":
gr.time_zone = "Europe/Helsinki";
break;
//Estonia
case "EE":
gr.time_zone = "Europe/Helsinki";
break;
//Sweden
case "SE":
gr.time_zone = "Europe/Stockholm";
break;
//Norway
case "NO":
gr.time_zone = "Europe/Oslo";
break;
//Denmark
case "DK":
gr.time_zone = "Europe/Copenhagen";
break;
//Spain
case "ES":
gr.time_zone = "Europe/Madrid";
break;
//Portugal
case "PT":
gr.time_zone = "Europe/Lisbon";
break;
//Italy
case "IT":
gr.time_zone = "Europe/Rome";
break;
//Turkey
case "TR":
gr.time_zone = "Europe/Istanbul";
break;
//France
case "FR":
gr.time_zone = "Europe/Paris";
break;
//Germany
case "DE":
gr.time_zone = "Europe/Berlin";
break;
}
gr.setWorkflow(false);
gr.autoSysFields(false);
gr.update();
}
gs.info("CJT Updated");
以上是关于javascript 按国家/地区代码设置默认时区的主要内容,如果未能解决你的问题,请参考以下文章