如何添加两天的日期和时间 [英] How to add two days for date and time
本文介绍了如何添加两天的日期和时间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
IAM在C#中使用asp.net
在datetime中,我必须添加2天,并且必须分别显示日期部分和时间部分,IAM使用这种格式可以帮助我如何获取日期部分和时间部分.
iam using asp.net with c#
in datetime i have to add 2 days and i have to display date part seperate and time part seperate, iam using this format can you help me how to get date part and time part.
System.DateTime now = System.DateTime.Now;
System.DateTime modifieddate = now.AddDays(2);
推荐答案
尝试以下操作:
Try this:
dateTime = DateTime.Now.AddBusinessDays(4);
使用流水日期时间 [ ^ ]
看看:
DateTime.Add方法 [ DateTime.AddDays方法 [将日期添加到日期 [
Use Fluent DateTime[^]
Have a look on:
DateTime.Add Method[^] & DateTime.AddDays Method[^]
Refer similar thread:
Adding Days to a Date[^]
DateTime dNow = DateTime.Now;
DateTime dNow1 = dNow.AddDays(2);
txt_date.Text = (dNow1.ToString("dd/MM/yyyy"));
txt_time.Text = (dNow1.ToString("hh:mm"));
希望对您有帮助.
I hope Its Help You.
日期部分:
for date part:
dToday = DateTime.Now.[Date]
对于时间部分:
for time part:
dToday = DateTime.Now.[Time]
希望它能起作用
Hope so it will work
这篇关于如何添加两天的日期和时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文