Full Date Short Time ("f") Format Specifier in C#

CsharpProgrammingServer Side Programming

The Full Date Short Time standard format specifier represents a combination of the long date ("D") and short time ("t") patterns.

UseDateTime to set the date.

DateTime myDate = new DateTime(2018, 8, 29, 1, 10, 0);

Now, use the (“f”) format specifier like this −

myDate.ToString("f", CultureInfo.CreateSpecificCulture("en-US"))

The following is an example −

Example

 Live Demo

using System;
using System.Globalization;
class Demo {
   static void Main() {
      DateTime myDate = new DateTime(2018, 8, 29, 1, 10, 0);
      Console.WriteLine(myDate.ToString("f",CultureInfo.CreateSpecificCulture("en-US")));
   }
}

Output

Wednesday, August 29, 2018 1:10 AM
raja
Published on 11-Sep-2018 16:40:19
Advertisements