/*
Mastering Visual C# .NET
by Jason Price, Mike Gunderloy
Publisher: Sybex;
ISBN: 0782129110
*/
/*
Example21_10.cs demonstrates culture formatting
*/
using System;
using System.Globalization;
public class Example21_10
{
public static void Main()
{
// create a date and a currency value
DateTime dtNow = DateTime.Now;
Double curOriginal = 12345.67;
// and format the variables for a specific culture
CultureInfo ci = new CultureInfo("en-US");
string sLocalizedDate = dtNow.ToString("d", ci);
string sLocalizedCur = curOriginal.ToString("c", ci);
// print them out
Console.WriteLine(sLocalizedDate);
Console.WriteLine(sLocalizedCur);
// and format them for a second culture
CultureInfo ci2 = new CultureInfo("en-GB");
string sLocalizedDate2 = dtNow.ToString("d", ci2);
string sLocalizedCur2 = curOriginal.ToString("c", ci2);
// print them out again
Console.WriteLine(sLocalizedDate2);
Console.WriteLine(sLocalizedCur2);
}
}