开发者

int to string to date

开发者 https://www.devze.com 2022-12-21 16:02 出处:网络
i use asp.net i have a int(10112009) in the end i want a date formate like day- day / month month / yyyy

i use asp.net

i have a int (10112009)

in the end i want a date formate like day- day / month month / yyyy

what's the b开发者_如何学Cest way (or a way) to do that?

thanks


I would do something like this:

int n = 10112009;
DateTime date;
if (DateTime.TryParseExact(n.ToString("00000000"), "ddMMyyyy", 
        CultureInfo.InvariantCulture, DateTimeStyles.None, out date))
{
    // use date
}
0

精彩评论

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