fork download
  1. using System;
  2. using System.Globalization;
  3. using System.Linq;
  4. using System.Collections.Generic;
  5. using System.Threading;
  6.  
  7. public class Test
  8. {
  9.  
  10. public static void Main()
  11. {
  12. int day = 1;
  13. string dayStr = day.ToString("D2");
  14. Console.WriteLine("ToString:" + dayStr);
  15. dayStr = "1";
  16. dayStr = dayStr.PadLeft(2, '0');
  17. Console.WriteLine("PadLeft:" + dayStr);
  18. }
  19. }
  20.  
Success #stdin #stdout 0.03s 33896KB
stdin
Standard input is empty
stdout
ToString:01
PadLeft:01