如何在C#的固定日期100天后显示 [英] How to show after 100 days date from FIXED DATE in C#

查看:111
本文介绍了如何在C#的固定日期100天后显示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有固定日期说示例日期是:02/02/2018

i需要为固定日期添加100天

但我知道datetime.now.addday( 100);

当我使用上面的第三行代码时。它会改变当前日期更改的日期。

请帮助我。



我尝试过的事情:



textBox1.Text = DateTime.Now.ToString(yyyy-MM-dd);

DateTime adddays = Convert.ToDateTime(textBox1.Text).AddDays(100); ;

textBox2.Text = adddays.ToString(yyyy-MM-dd);

i have fixed date say example date is:02/02/2018
i need to add 100 days for fixed date
but i know datetime.now.addday(100);
when i using the above third line code. it change the date when the current date change.
Please Help me.

What I have tried:

textBox1.Text = DateTime.Now.ToString("yyyy-MM-dd");
DateTime adddays = Convert.ToDateTime(textBox1.Text).AddDays(100); ;
textBox2.Text = adddays.ToString("yyyy-MM-dd");

推荐答案

DateTime fixedDate = new DateTime(2008, 2, 2);
DateTime newDate = fixedDate.AddDays(100);


这篇关于如何在C#的固定日期100天后显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆