ive got 2 strings, date:”27.03.11 ” and time:”15:04″, which id like to format as a PubDate elemnt for a rss file like Fri, 18 Nov 2005 19:12:30 GMT.
How can i do this in c sharp?
ive got 2 strings, date:27.03.11 and time:15:04, which id like to format as a
Share
Use the following steps:
DateTimevariable. Use the DateTime.ParseExact static method for this.Format this variable into a string using the DateTime.ToString method. The following MSDN pages will help you choose the correct format string based on your needs:
Since RSS requires dates to be in the RFC 822 format, the following related SO question might help you with the last step:
EDIT: For the first step, have a look at this example:
(The
\:ensures that:is seen as a literal:rather than a culture-specific time separator.)