Пример #1
0
        public static string WriteToString(this IDateTimeFormatter formatter)
        {
            var sb = new StringBuilder();

            using (var stream = new StringWriter(sb))
                formatter.Write(stream);
            return(sb.ToString());
        }
Пример #2
0
 public static void WriteLine(this IDateTimeFormatter formatter, TextWriter writer)
 {
     formatter.Write(DateTime.UtcNow, writer);
     writer.WriteLine();
 }