Write a C# Sharp program to convert the value of the current DateTime object to its equivalent string representation using the formatting conventions of the current culture
- برمجة سي شارب
- برمجة
- 2021-06-01
- ahmadghneem
الأجوبة
using System;
using System.Globalization;
using System.Threading;
public class Example36
{
public static void Main()
{
CultureInfo currentCulture = Thread.CurrentThread.CurrentCulture;
DateTime exampleDate = new DateTime(2016, 5, 16, 18, 32, 6);
// Display the date using the current (en-US) culture.
Console.WriteLine(exampleDate.ToString());
// Change the current culture to fr-FR and display the date.
Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture("fr-FR");
Console.WriteLine(exampleDate.ToString());
// Change the current culture to ja-JP and display the date.
Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture("ja-JP");
Console.WriteLine(exampleDate.ToString());
// Restore the original culture
Thread.CurrentThread.CurrentCulture = currentCulture;
}
}أسئلة مشابهة
القوائم الدراسية التي ينتمي لها السؤال