我怎么能得到15和30或31的日期我正在创建一个加班表格我需要支付期限设置为15或30

时间:2014-07-22 06:00:22

标签: c#

我怎样才能在15和30或31之间得到日期我正在创建一个加班表格我需要在15或30中设置付款期限。

 Date Time pm5 = Date Time.Parse(date2)Add Days(15);
 string mystring5;
 mystring5 = pm5.To String("MM/dd/y y");
 textBox44.Text = mystring5;

1 个答案:

答案 0 :(得分:0)

这样的东西?

DateTime today = DateTime.Today;
DateTime payDay;
if(today.Day <= 15)
    payDay = new DateTime(today.Year, today.Month, 15);
else
    payDay = new DateTime(today.Year, today.Month, DateTime.DaysInMonth(today.Year, today.Month));