gpt4 book ai didi

asp.net - int to string to date

转载 作者:行者123 更新时间:2023-12-01 04:19:52 25 4
gpt4 key购买 nike

我使用asp.net

我有一个 int (10112009)

最后,我想要一个日期格式,如日-日/月/月/yyyy

最好的方法(或方法)是什么?

谢谢

最佳答案

我会做这样的事情:

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

关于asp.net - int to string to date,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2347110/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com