当前位置: 移动技术网 > IT编程>脚本编程>VBScript > VBS教程:函数-GetLocale 函数

VBS教程:函数-GetLocale 函数

2017年12月12日  | 移动技术网IT编程  | 我要评论

getlocale 函数

返回当前区域设置 id 值。

getlocale()

说明

locale 是用户参考信息集合,与用户的语言、国家和文化传统有关。locale 决定键盘布局、字母排序顺序和日期、时间、数字与货币格式。

返回值可以是任意一个 32-位 的值,如 区域设置 id所示:

下面举例说明 getlocale 函数的用法。要使用该代码,请复制标准html 文件中 <body>l 标志之间的所有内容。

enter date in uk format: <input type="text" id="ukdate" size="20"><p>here's the us equivalent: <input type="text" id="usdate" size="20"><p><input type="button" value="convert" id="button1"><p>enter a price in german:   <input type="text" id="germannumber" size="20"><p>here's the uk equivalent: <input type="text" id="usnumber" size="20"><p><input type="button" value="convert" id="button2"><p><script language="vbscript">dim currentlocale' get the current localecurrentlocale = getlocalesub button1_onclick  dim original  original = setlocale("en-gb")  mydate = cdate(ukdate.value)  ' ie always sets the locale to us english so use the  ' currentlocale variable to set the locale to us english  original = setlocale(currentlocale)  usdate.value = formatdatetime(mydate,vbshortdate)end subsub button2_onclick  dim original  original = setlocale("de")  myvalue = ccur(germannumber.value)  original = setlocale("en-gb")  usnumber.value = formatcurrency(myvalue)end sub</script> 

如对本文有疑问, 点击进行留言回复!!

相关文章:

验证码:
移动技术网