21
1
using System;
2
using System.Globalization;
3
using System.Threading;
4
5
public class Program
6
{
7
public static void Main()
8
{
9
var todayDate = DateTime.Today;
10
string strToday = todayDate.ToString(); // converts date to string as per current culture
11
Console.WriteLine("Date String in Default Culture: " + strToday);
12
13
Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US");
14
string strTodayUS = todayDate.ToString(); // converts date to string in MM/DD/YYYY format
15
Console.WriteLine("Date String in en-US Culture: " + strTodayUS);
16
17
Thread.CurrentThread.CurrentCulture = new CultureInfo("fr-FR");
18
string strTodayFR = todayDate.ToString(); // converts date to string in DD/MM/YYYY format
19
Console.WriteLine("Date String in fr-FR Culture: " + strTodayFR);
20
}
21
}
Cached Result