Microsoft KB Archive/232158

= How To Use GetLocale and SetLocale in VBScript =

Article ID: 232158

Article Last Modified on 8/8/2007

-

APPLIES TO


 * Microsoft Visual Basic, Scripting Edition 5.0

-



This article was previously published under Q232158



SUMMARY
Visual Basic Scripting Edition (VBScript) version 5.0 supports the functionality of retrieving and changing the current locale settings of your current Web page. The two functions that support this feature are GetLocale and SetLocale.

GetLocale returns the current locale on the client machine. SetLocale sets the locale to the new specified locale

These functions can be used accordingly to localize the date, time, or currency of your Web page.

NOTE: GetLocale and SetLocale are not supported in JavaScript.



MORE INFORMATION
The following example demonstrates GetLocale and SetLocale: 

  Dim curLocale

sub window_onload curLocale= GetLocale

MsgBox "The current locale is " & GetLocale MsgBox "The current date is " & Date MsgBox "The current time is " & Time

Dim MyCurrency MyCurrency = FormatCurrency(100) MsgBox "100 U.S. dollars in the U.S is " & MyCurrency end sub

sub window_onunload SetLocale(curLocale) end sub

sub changetoFrenchLoc Dim newLocale Dim french_lcid

french_lcid =1036

'set locale to French SetLocale(french_lcid)

MsgBox "The current locale is " & GetLocale MsgBox "The current date is " & Date MsgBox "The current time is " & Time

Dim MyCurrency MyCurrency = FormatCurrency(100 * 6.37546) MsgBox "100 U.S. dollars in France is " & MyCurrency end sub





  



