开发者

How to convert smalldatime GMT Format?

pubdate is smalldatetime.

new XElement("pubDate", FormatPubDate(Convert.ToDateTime(rDetail.PubDate)))
    ///******************
private static string FormatPubDate(DateTime pubDate)
{
    //string Format = "yyyy-MM-dd HH:mm:ss";
    string _tmpdate = pubDate.ToUniversalTime().ToStri开发者_运维问答ng("R");
    return pubDate.ToString(_tmpdate);
}

my format is ri, 14 Jan 2011 08:34:00 G1T but i want to this format Mon, 17 Jan 2011 10:16:12 GMT


It's unclear what you're asking, as the "R" format generates the form you said you're asking for. That is ToString("R") will give Mon, 17 Jan 2011 10:16:12 GMT.

Take a look at the documentation for ToString(string) for a list of standard date/time format strings and sample outputs.

If there's not a standard format string that meets your needs, then you can construct your own Custom Date and Time Format Strings.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜