Using CultureInfo to modify output
Using CultureInfo to modify output
October 27, 2003
Mostly we want to change output results of our applications to another culture setting. In this code sniplet we will format current date time for our culture settings.
Now first let's see which culture settings and outputs we can change.
| en-US | 4/10/2001 |
| en-NZ | 10/04/2001 |
| de-DE | 10.04.2001 |
| en-US | Tuesday, April 10, 2001 |
| en-US | 3:51:24 PM |
| es-ES | 15:51:24 |
| en-US | Tuesday, April 10, 2001 3:51 PM |
| fr-FR | mardi 10 avril 2001 15:51 |
| en-US | Tue, 10 Apr 2001 15:51:24 GMT |
| zh-SG | Tue, 10 Apr 2001 15:51:24 GMT |
| en-US | 2001-04-10T15:51:24 |
| pt-BR | 2001-04-10T15:51:24 |
| en-US | 2001-04-10 15:51:24Z |
| sv-FI | 2001-04-10 15:51:24Z |
| en-US | April 10 |
| ms-MY | 10 April |
| en-US | April, 2001 |
| af-ZA | April 2001 |
| en-UZ | Unrecognized format specifier; a format exception is thrown. |
And now we are formating date time for France (fr-FR). To understand output we will format a long date time.
<%@ Page Language="VB" Debug="true" %>
<%@ Import Namespace="System.Globalization" %>
<script language="VB" runat="server">
Sub Page_Load(Source as Object, E as EventArgs)
Dim dt As DateTime = DateTime.Now
Dim strCultureInfo As CultureInfo = New CultureInfo("fr-FR")
response.write( dt.ToString("f", strCultureInfo ) )
end sub
</script>
Our out will be like this :
lundi 27 octobre 2003 22:54
Read More
Custom Search
- Simple XML RSS Parser
- Generating Random Number Using RND Function And Randomize Statement
- How to Refresh a web page or redirect to another page
- Custom Paging in ASP Fast And Easy
- Professional Contact Form
- Creating Access Database Connection String
- Using DateDiff function in SQL Statement
- VBScript Examples DatePart Function
- Executing Transact SQL UPDATE statement using SQLCommand
- Custom Paging results in ASPNET using A Better Way
- Using GetDate Function in an SQL Statement
- Copying Folders using File System Object
- Form to Mail Using CDO
- Sending Emails in JSP
- MySQL AB Offers its Enterprise Database Subscriptions through the New Red Hat Exchange
- Easy Download Manager Free Version
- ASP Chat Box
- Writing Form Data to Text Files
- Paging Records in JSP
- What is Ecommerce and the Importance of Ecommerce
- Beginning-Ajax-and-ASPNET-35
- How to upload images to mySQL within PHP
- Simple XML RSS Parser
- Counting records in PHP mySQL
- ActiveNews Manager Freeware News Exchange Software
- How to write and use a JavaBean My frst java bean
- Paging Results in PHP
- Free User Registration Form
- A-timesaver-control-GridView
- ASPNET Web Counter Free Open Source Code
- Easy Download Manager Free Version
- ASP Chat Box
- Writing Form Data to Text Files
- Paging Records in JSP
- Beginning-Ajax-and-ASPNET-35
- How to upload images to mySQL within PHP
- Simple XML RSS Parser
- ActiveNews Manager Freeware News Exchange Software
- Counting records in PHP mySQL
- How to write and use a JavaBean My frst java bean
- Paging Results in PHP
- Free User Registration Form
- A-timesaver-control-GridView
- ASPNET Web Counter Free Open Source Code
- Comparing Dates