我为放映日期写的日期是截止日期的代码 [英] which code i write for show day with Due date

查看:104
本文介绍了我为放映日期写的日期是截止日期的代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的项目中
两个DateTime字段1)TodayDate 2)DueDate.
但是我有一个问题想用DueDate显示日期.

Day必须与TodayDate和DueDate不同.

例如:今天日期:2012年8月23日时间
截止日期:2012年8月28日

现在,我要显示DueDate像:28/8/2012,5

5是天,今天和到期日之间是不同的.

拜托,任何人都可以帮我解决这个问题.如果您需要更多示例,我将给出.

In my project
Two DateTime Field 1) TodayDate 2) DueDate.
But i have one problem that i want to display day with DueDate.

Day must be Different TodayDate & DueDate.

ex : TodayDate : 23/8/2012 time
DueDate : 28/8/2012 time

now , i want to display DueDate like : 28/8/2012,5

5 is Day, and it is differents between todaydate and duedate.

Please, Can Any one help me for this situatuin. if you want more example i will give.

推荐答案

您好,Akash,

您会发现几天中两个日期之间的差异

Hi Akash,

you can find difference between two date in days with flowing

DateTime d1;
DateTime d2;
return (d1 - d2).TotalDays;



现在可以显示带有日期的日差,将您的日期转换为格式
喜欢
String.Format



now to display day differences with date convert your date in format
like
String.Format

("{0:d/M/yyyy }", dt)

并在字符串
中附加,"的区别
通过这种方式,您可以生成所需的结果

and append the "," sing and day difference in string

in this way you can generate your desire result


您将今天的日期存储为日期时间格式:
http://msdn.microsoft.com/en-us/library/system.datetime.aspx [^ ]

如果要选择日期或允许用户选择日期,则应使用DateTimePicker:
http://msdn.microsoft.com/en-us/library/system. windows.forms.datetimepicker.aspx [ ^ ]

而要添加5天,则需要TimeSpan类:
http://msdn.microsoft.com/en-us/library/system.timespan.aspx [^ ]

现在剩下的就是让您阅读文档并开始工作:)
You have the today date stored in a datetime format:
http://msdn.microsoft.com/en-us/library/system.datetime.aspx[^]

If you want to select a date, or allow the user to select the day, you should use the DateTimePicker:
http://msdn.microsoft.com/en-us/library/system.windows.forms.datetimepicker.aspx[^]

And you want to add 5 days, you will need the TimeSpan class:
http://msdn.microsoft.com/en-us/library/system.timespan.aspx[^]

So now all that is left is for you to read the documentation and get to work :)


这篇关于我为放映日期写的日期是截止日期的代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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