VBS Tutorial: function-GetLocale Function

Source: Internet
Author: User

GetLocale Function

Returns the ID of the current region.

GetLocale()

Description

LocaleIt is a collection of user reference information, which is related to the user's language, country, and cultural traditions.LocaleDetermines the keyboard layout, alphabetical order, date, time, number, and currency format.

The returned value can be any 32-bit value, as shown in the region setting ID:

The following is an exampleGetLocaleFunction usage. To use this code, copy all content between the <BODY & gtl flag in the standard HTML file.

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_nclick  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_nclick  Dim original  original = SetLocale("de")  myvalue = CCur(GermanNumber.value)  original = SetLocale("en-gb")  USNumber.value = FormatCurrency(myvalue)End Sub</script> 

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.