Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我怎样才能得到日期:
这样做的原因是我想比较所有用户创建日期并检查用户是否在过去三周或去年注册。
在 C# ASP.NET 网站中。
提前致谢。
最近三个月
DateTime threeMonthsAgo = DateTime.Now.AddMonths(-3)
去年
DateTime oneYearAgo = DateTime.Now.AddYears(-1)
然后您可以将该DateTime实例与DateTime.Now.
DateTime
DateTime.Now