IIS 6.0

The @LCID processing directive specifies how dates, times, and currencies are formatted. Locale identifiers (LCIDs) are not the same for each geographical locale. Some locales format dates as YY-MM-DD and some format dates as MM-DD-YYYY. The @LCID processing directive is write-only.


The locale group has to be installed on the Web server before its locale identifier can be specified in a Web page or application. Use the Regional and Language Options control panel application to install locale groups.

The LCID is a DWORD containing the language identifier in the lower word and a reserved value in the upper word. The identifier supplied in an LCID is a standard international numeric abbreviation. This LCID has the components necessary to uniquely identify one of the installed system-defined locales. There are two predefined LCID values: LOCALE_SYSTEM_DEFAULT is the system default locale, and LOCALE_USER_DEFAULT is the current user's locale.

<%@ LCID = localeidentifier %>


A valid locale identifier.

Setting @LCID explicitly affects literal (static) strings in a single response. Response.LCID affects dynamic strings in a single response, and Session.LCID affects dynamic strings in all responses in a session.

If @LCID is not explicitly set in a page, it is implicitly set by the AspLCID metabase property or by the default system locale.

If you set Response.LCID or Session.LCID explicitly, do so before displaying formatted output. If you use literal and nonliteral output in the same page, make sure the locale of @LCID matches the locale of Response.LCID, or the literal output is formatted differently from the nonliteral output.

Setting @LCID changes the locale for both the ASP application and the scripting engine. Using the VBScript function setLocale only changes the locale for the scripting engine.

If the locale of your Web page matches the system defaults of the Web client, you do not need to set a locale in your Web page. However, setting the value is recommended.

If the locale is set in a page, and the code page is set to display the characters properly, Response.Charset should also be set. The code page value specifies to IIS how to encode the data when building the response, and the charset value tells the browser how to decode the data when displaying the response. The CharsetName of Response.Charset must match the code page value, or mixed characters are displayed in the browser. Lists of CharsetNames and matching code page values can be found on MSDN Web Workshop under the columns for Preferred Charset Label and FamilyCodePage.

If you are writing and testing Web pages that use different locales, code pages, and character sets (for example, if you are creating a multilingual Web site), remember that your test client computer must have the language packs installed for each language you wish to display. You can install language packs from Regional and Language Options on the Control Panel.

The following example page starts off by setting @LCID to Russia, then changes it to Korea.

--- LCID.asp ---

<%@ LCID=1049 %> 

' This file doesn't need to be saved in UTF-8 format because  
'  there are no literal strings that need formatting or encoding. 

Response.Codepage = 65001 
Response.Charset = "utf-8" 

' The LCID is already 1049 
Response.Write "<B>Russia</B><BR>" 
Response.Write FormatDateTime("17/01/2001", 1) & "<BR>" 
Response.Write FormatDateTime("17:41:35", 3) & "<BR>" 
Response.Write FormatCurrency(1000) & "<BR>" 
Response.Write FormatNumber(50, 3, 0, 0, -1) & " & " & FormatNumber(.02, 3, 0, 0, -1) & "<BR><BR>" 

' Now change the LCID to Korea 
Response.LCID = 1042 
Response.Write "<B>Korea</B><BR>" 
Response.Write FormatDateTime(Date, 1) & "<BR>" 
Response.Write FormatDateTime(Time, 3) & "<BR>" 
Response.Write FormatCurrency(1000) & "<BR>" 
Response.Write FormatNumber(50, 3, 0, 0, -1) & " & " & FormatNumber(.02, 3, 0, 0, -1) & "<BR><BR>" 

Client: Requires Windows XP Professional, Windows 2000 Professional, or Windows NT Workstation 4.0.

Server: Requires Windows Server 2003, Windows 2000 Server, or Windows NT Server 4.0.

Product: IIS