从加入日期算起服务期限 [英] find length of service from date of joining
问题描述
我有加入"的日期,我需要从中找到服务年限"
像这样3年45天
日期日期格式的加入日期
将SQLServer 2005与ASP.NET C#一起使用
任何1个人都可以提供帮助,并在此先表示感谢.
I have date of "Joining" and I need to find "length of service" from it
in this format like this 3years 45 days
date of joining in datetime format
Using sqlserver 2005 with asp.net c#
any 1 can help and thanks in advance
推荐答案
嗨...
使用此存储过程获取自加入之日起经过的天数:
Hi...
Use this stored procedure to get the number of days passed from date of joining:
create procedure sp_workLength
(
@dateofjoin datetime
}
as
select datediff(day, @dateofjoin , getdate())
一旦获得了天数,然后使用两个简单的C#语句来计算工作时间...让天数被收集到变量numdays
中.
int numofyears = numdays/365;
int numofdays = numdays%365;
现在打印:
numofyears.ToString()+"Years" + numofdays.ToString()+"Days"
希望这是问题的答案...
祝你好运
Once you get the number of days, then use two simple C# statements to calculate work length...let the number of days been collected in variable numdays
.
int numofyears = numdays/365;
int numofdays = numdays%365;
now print:
numofyears.ToString() + " Years " + numofdays.ToString() + " Days"
Hope this is the answer of question...
Gud luck
这篇关于从加入日期算起服务期限的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!