如何在文本框中计算未来3个月的日期?

编程入门 行业动态 更新时间:2024-10-25 11:25:40
本文介绍了如何在文本框中计算未来3个月的日期?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

如何在文本框中计算接下来3个月的日期?

how to calculate next 3 month for date in textbox ?

推荐答案

您正在寻找: 今天日期后两周: Are you looking for like : Two weeks after today's date: DateTime.Now.Date.AddDays(2*7)

$ / b $ b或 今天日期后三个月:

Or Three months after today's date:

DateTime.Now.Date.AddMonths(3)

嗨 假设您从文本框中获取日期为01/01/2013​​,您可以使用 C#代码 string date = txt Hi Suppose you get the date from text box is "01/01/2013" the in C# code you can use string date = txt fname.Text.ToString(); // you text box date var d = date.Split('/'); int day =Convert.ToInt16( d[0]); int month =Convert.ToInt16( d[1]); int year =Convert.ToInt16( d[2]); DateTime newdate =new DateTime(year, month, day).AddMonths(3);

我希望它可以帮到你。 谢谢你

I hope it helps you . thank you

更多推荐

如何在文本框中计算未来3个月的日期?

本文发布于:2023-11-22 09:46:37,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1616941.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:个月   框中   文本   日期   未来

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!