fork download
  1. using System;
  2. public static class Methods
  3. {
  4. public static DateTime ToDateTime(this DateTime _DateTime, string data, string hora)
  5. {
  6. try
  7. {
  8. return DateTime.Parse(string.Format("{0}/{1}/{2} {3}:{4}",
  9. data.Substring(0, 2),
  10. data.Substring(2, 2),
  11. data.Substring(4, 4),
  12. hora.Substring(0, 2),
  13. hora.Substring(2, 2)));
  14. }
  15. catch (FormatException ex)
  16. {
  17. throw ex;
  18. }
  19. }
  20. }
  21. public class Test
  22. {
  23. public static void Main()
  24. {
  25. DateTime date = DateTime.Now.Date.ToDateTime("08072013", "1515");
  26. System.Console.WriteLine(date.ToString("dd/MM/yyyy H:m"));
  27. }
  28. }
Success #stdin #stdout 0.07s 34008KB
stdin
Standard input is empty
stdout
07/08/2013 15:15