小编joe*_*den的帖子

如何从C#中的日期字符串获取本月的最后一天?

如何找到字符串中所述的当月最后一天?

例如,如果字符串是"2018年1月",我将如何记录31/01/2018作为日期

目前默认为本月的第一天:

string nextEventDateString = "January 2018"
DateTime tempDate;

if (DateTime.TryParse(nextEventDateString, out tempDate))
{
    cRecord.ComplianceDate = tempDate.ToString("dd/MM/yyyy");
    cRecord.NotifyDate = tempDate.AddMonths(-1).ToString("dd/MM/yyyy");
    cRecord.WarningDate = tempDate.AddMonths(1).ToString("dd/MM/yyyy");
}
Run Code Online (Sandbox Code Playgroud)

c#

2
推荐指数
1
解决办法
335
查看次数

转换完整日期和日期

我想知道是否有可能转换完整的日期和日期,例如

2013年4月18日星期四

string(DD/MM/YYYY)

c# asp.net

-6
推荐指数
1
解决办法
165
查看次数

标签 统计

c# ×2

asp.net ×1