用户登录
用户注册

分享至

VBS教程:函数-GetLocale 函数

  • 作者: 七秒锺记忆
  • 来源: 51数据库
  • 2021-08-27

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> 
软件
前端设计
程序设计
Java相关