fork download
  1. using System;
  2. using System.Linq;
  3. using System.Collections.Generic;
  4.  
  5. public class Test
  6. {
  7.  
  8. public static void Main()
  9. {
  10. String dateString = "01.02.2004";
  11. var deCulture = System.Globalization.CultureInfo.CreateSpecificCulture("de-DE");
  12. DateTime dt = DateTime.Parse(dateString, deCulture);
  13. dateString = dt.ToString("yyyy-MM-dd");
  14. Console.Write(dateString);
  15. }
  16.  
  17. }
  18. public static class Extensions
  19. {
  20. public static bool ElementAtPosContains(this string inputStr, int index, IList<String> valuesToCheck)
  21. {
  22. if (valuesToCheck == null || inputStr.Length < index)
  23. return false;
  24.  
  25. return valuesToCheck.Any(s => s.Length + index <= inputStr.Length
  26. && inputStr.IndexOf(s, index) == index);
  27. }
  28. }
Success #stdin #stdout 0.08s 34112KB
stdin
Standard input is empty
stdout
2004-02-01