计算天数的公式 [英] Formula to calculate the number of days
本文介绍了计算天数的公式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在A1 =``2012年5月20日''中有B1 =``否'',我想在C1中有一个公式来计算日期之间的天数,因此:
I have in A1 = ''20-05-2012'' B1 = ''NO'' and I want in C1 a formula to calculate the number of days between to dates, so:
string today = DateTime.Now;
if(B1='NO')
{
//Here I want that C1 = '3'
//and tomorow will C1 = '4'
//because the number of days between 20-05-2012 and 23-05-2012 = 3
//and tomorrow the number of days between 20-05-2012 and 24-05-2012 = 4
}
如何在excel中执行此操作?
我希望你能理解我的问题...
问候,
KZ
How I do this in excel?
I hope you understand my question...
Regards,
KZ
推荐答案
您需要DateDiff
函数.
在这里看看:
http://msdn.microsoft.com/en-us/library/ms127413.aspx [ ^ ]
http://social.msdn.microsoft.com/Forums/eu/csharpgeneral/thread/f7094472-b473-4a29-8a90-d32056d05bef [
You needDateDiff
function.
Take a look here:
http://msdn.microsoft.com/en-us/library/ms127413.aspx[^]
http://social.msdn.microsoft.com/Forums/eu/csharpgeneral/thread/f7094472-b473-4a29-8a90-d32056d05bef[^]
如果您想要高效的算法,那么您可以看看:
http://alcor.concordia.ca/~gpkatch/gdate-algorithm.html [ ^ ]
If you want highly efficient algorithms, then you want look at:
http://alcor.concordia.ca/~gpkatch/gdate-algorithm.html[^]
我已经解决了我的朋友:
= IF(E4 ="NO";(D4-TODAY())*-1;"OK")
这给了我两个日期之间的天数:
D4 ="23-05-2012"
(D4-TODAY())*-1
但是谢谢!
KZ
I already solve it my friend:
=IF(E4="NO";(D4-TODAY())*-1;"OK")
this gives me the number of days between two dates:
D4="23-05-2012"
(D4-TODAY())*-1
But thanks!
KZ
这篇关于计算天数的公式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文