DateTimeFormatInfo.TimeSeparator : DateTimeFormatInfo « System.Globalization « C# / C Sharp by API






DateTimeFormatInfo.TimeSeparator

  


using System;
using System.Globalization;
using System.Threading;

class Class1 {
  static void Main(string[] args) {
      CultureInfo MyCulture = new CultureInfo("fr-FR");
      DateTime MyDate = System.DateTime.Now;

      Thread.CurrentThread.CurrentCulture = MyCulture;

      DateTimeFormatInfo dtf = MyCulture.DateTimeFormat;
      //Change date and time separator
      dtf.DateSeparator = "\\";
      dtf.TimeSeparator = "&";

      Console.WriteLine();
      Console.WriteLine(MyDate.ToLongDateString());
      Console.WriteLine(MyDate.ToLongTimeString());
      Console.WriteLine(MyDate.ToShortDateString());
      Console.WriteLine(MyDate.ToShortTimeString());
   }
}

   
    
  








Related examples in the same category

1.DateTimeFormatInfo.CurrentInfo
2.DateTimeFormatInfo.DateSeparator
3.DateTimeFormatInfo.DateTimeFormat
4.DateTimeFormatInfo.GetAllDateTimePatterns
5.DateTimeFormatInfo.LongDatePattern