Guest User

Untitled

a guest
Jun 20th, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.08 KB | None | 0 0
  1. public static string FormatPubDate(DateTime pubDate)
  2. {
  3. string _rfc822Format = "ddd, dd MMM yyyy HH:mm:ss";
  4. string _tmp = pubDate.ToUniversalTime().ToString(_rfc822Format);
  5.  
  6. return pubDate.ToString(_tmp + " UT");
  7. }
  8.  
  9. Console.WriteLine(FormatPubDate(new DateTime(2008, 12, 16, 13, 44, 33)));
  10. Console.WriteLine(FormatPubDate(new DateTime(2008, 12, 17, 13, 44, 33)));
  11. Console.WriteLine(FormatPubDate(new DateTime(2009, 3, 18, 4, 17, 20)));
  12. Console.WriteLine(FormatPubDate(new DateTime(2009, 4, 30, 10, 44, 33)));
  13.  
  14. Tue, 16 Dec 2008 19:44:33 UT
  15. We17, 17 Dec 2008 19:44:33 UT
  16. We18, 18 3ar 2009 09:17:20 UT
  17. T10u, 30 Apr 2009 15:44:33 UT
  18.  
  19. return pubDate.ToString(_tmp + " UT");
  20.  
  21. string _rfc822Format = "ddd, dd MMM yyyy HH:mm:ss";
  22. string _tmp = pubDate.ToUniversalTime().ToString(_rfc822Format);
  23.  
  24. return _tmp + " UT";
  25.  
  26. String.Format("{0:r}", dt); // "Sun, 09 Mar 2008 16:05:07 GMT" RFC1123
  27.  
  28. public static string FormatPubDate(DateTime pubDate)
  29. {
  30. string _rfc822Format = "ddd, dd MMM yyyy HH:mm:ss";
  31. return pubDate.ToUniversalTime().ToString(_rfc822Format) + " UT";
  32.  
  33. }
Add Comment
Please, Sign In to add comment