DateTime time = DateTime.Now; string s = time.ToString("yyyy.MM.dd hh:mm:ss t\\M"); Console.WriteLine(s);