0

Convert US date to EU date in C# project?

using System; using System.Globalization; public class Example { public static void Main() { string dateString, format; DateTime result; CultureInfo provider = CultureInfo.InvariantCulture; // Parse date-only value with invariant culture. dateString = "11/25/2019"; format = "d"; try { result = DateTime.ParseExact(dateString, format, provider); Console.WriteLine("{0} converts to {1}.", dateString, result.ToString()); } catch (FormatException) { Console.WriteLine("{0} is not in the correct format.", dateString); } // Parse date-only value without leading zero in month using "d" format. // Should throw a FormatException because standard short date pattern of // invariant culture requires two-digit month. dateString = "11/25/2019"; try { result = DateTime.ParseExact(dateString, format, provider); Console.WriteLine("{0} converts to {1}.", dateString, result.ToString());

2nd Jun 2021, 9:44 AM
BEHCET AYTIMUR AHISKA
BEHCET AYTIMUR AHISKA - avatar
1 Odpowiedź
0
What is wrong of this codes in C# that are not an acceptable answer to the related project?
2nd Jun 2021, 9:46 AM
BEHCET AYTIMUR AHISKA
BEHCET AYTIMUR AHISKA - avatar