Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


Tip of the Day
Language: Web
Expertise: All
May 6, 1999

Format Dates in Active Server Pages Using the Locale Identifiers

The Active Server Pages Session object includes an under-used property called LCID. The LCID, or locale identifier, helps you format your ASP code to suit your target audience. For instance, Canada tends to use dd/mm/yy to format dates while Germany uses dd.mm.yy. Here's some example ASP code that shows how the same date takes on a different look according to the LCID:
 
<%
USEnglish=1033
EnglishCanada=4105
German=1031
thedate=date()
Session.LCID=USEnglish
Response.Write thedate & "<BR>"
Session.LCID=EnglishCanada
Response.Write thedate & "<BR>"
Session.LCID=German
Response.Write thedate & "<BR>"
%>
The code produces this output in the browser:
 
4/25/99
25/04/99
25.04.99
For more information on language codes, check http://www.microsoft.com/OpenType/otspec/lcid-cp.txt.
Ken Cox
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap
Thanks for your registration, follow us on our social networks to keep up-to-date