VBS TUTORIAL: function-setlocale function _vbs

Source: Internet
Author: User
Tags locale

SetLocale function

Sets the global locale and returns the previous locale.

SetLocale(lcid)

The LCID parameter can be either a valid 32-bit value or a short string that uniquely identifies a geographic region. Values that can be identified can be consulted on the locale ID table.

Description

If the lcid is zero, the region is set to match the current system settings.

A locale is a collection of user reference information, which is related to the user's language, country and cultural tradition. The locale determines the keyboard layout, alphabetical sort order, and date, time, number, and currency format.

The following example illustrates the use of the SetLocale function. To use this code, copy all the content between the <BODY> flags in the standard HTML file.

Enter Date in UK format: <input type= "text" id= "ukdate" size= "" ><p>here "S" US equivalent: <input type= "Text" id= "usdate" size= "><p><input type=" button "value=" Convert "id=" Button1 "><p>enter A  Price in German:   <input type= "text" id= "Germannumber" size= "><p>here" the UK equivalent: <input Type= "text" id= "Usnumber" size= "><p><input type=" button "value=" Convert "id=" Button2 "><p>  <script language= "VBScript" >dim Currentlocale ' get to the current Localecurrentlocale = Getlocalesub Button1_onclick  Dim Original original = SetLocale ("EN-GB") mydate = CDate (ukdate.value) ' IE always sets the locale to US 中文版 so use The ' Currentlocale variable to set the locale to US 中文版 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>    

Please see

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.