fork(1) download
  1. using System;
  2. using System.Globalization;
  3.  
  4. public class Test
  5. {
  6. public static void Main()
  7. {
  8. string date = "Lunes, 16 de febrero de 2015 a las 18:49 UTC-05".ToLower();
  9. string dateTimeFormat = "dddd, d 'de' MMMM 'de' yyyy 'a las' HH:mm UTCzz";
  10. DateTime d1;
  11. //foreach (CultureInfo culture in CultureInfo.GetCultures(CultureTypes.AllCultures)) {
  12. DateTime.TryParseExact(date, dateTimeFormat, CultureInfo.GetCultureInfo("es-ES"), DateTimeStyles.None, out d1);
  13. Console.WriteLine(d1.ToString());
  14. //}
  15. //Console.WriteLine(d1.ToString());
  16. DateTime d2;
  17. DateTime.TryParse(date, out d2);
  18. Console.WriteLine(d2.ToString());
  19.  
  20. DateTime d3 = new DateTime(2015, 2, 16, 18, 49, 0);
  21. Console.WriteLine(d3.ToString(dateTimeFormat, CultureInfo.GetCultureInfo("es-ES")));
  22.  
  23. }
  24. }
Success #stdin #stdout 0.15s 24512KB
stdin
Standard input is empty
stdout
1/1/0001 12:00:00 AM
1/1/0001 12:00:00 AM
lunes, 16 de febrero de 2015 a las 18:49 UTC+00