ตัวระบุรูปแบบมาตรฐานของ Full Date Short Time แสดงถึงการรวมกันของรูปแบบวันที่แบบยาว ("D") และแบบเวลาสั้น ("t")
ใช้DateTime เพื่อตั้งวันที่
DateTime myDate = new DateTime(2018, 8, 29, 1, 10, 0);
ตอนนี้ ใช้ตัวระบุรูปแบบ (“f”) แบบนี้ –
myDate.ToString("f", CultureInfo.CreateSpecificCulture("en-US")) ต่อไปนี้เป็นตัวอย่าง −
ตัวอย่าง
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")));
}
} ผลลัพธ์
Wednesday, August 29, 2018 1:10 AM