DateTime d1,d2;
TimeSpan = d2-d1;
Result=format(d2-TimeSpan,"YY年MM月DD日")
TimeSpan = d2-d1;
Result=format(d2-TimeSpan,"YY年MM月DD日")
解决方案 »
- 如何让局域网用户访问我的ASP.NET网站?
- IIS7怎么使用ISAPI_rwrite实现伪静态?
- .net 如何获取JS 中的变量?
- 自己编写的ASP.NET提供程序没有测试连接按钮
- 懂codesmith的朋友进来看下
- CJOL,51JOB,智联招聘,CHINAHR 的简历 怎么样可以对应到一个固定格式的简历上
- 关于用web.config里面appSettings连接数据库的问题,在线等!!
- IE地址栏中按回车则没反应
- 怎么解决:未能找到objectdatasource的typename属性
- 如何实现定时执行任务功能?
- 怎样在DATAGRID里做想GOOGLE那样的分页?GOOOOOOOOOOGLE
- give me a help
TimeSpan ts=new TimeSpan(d2.Ticks-d1.Ticks);ts.ToString("yyyy年MM月");
System.DateTime dt2=DateTime.Parse("2003-1-2".ToString());
int Year1=int.Parse(dt2.Year.ToString())-int.Parse(dt1.Year.ToString());
int Month1=int.Parse(dt2.Month.ToString())-int.Parse(dt1.Month.ToString());
if(Month1<0)
{
Year1=Year1-1;
Month1=12+Month1;
}
String strSpan=Year1.ToString()+"年"+Month1.ToString()+"月";//strSpan就是你要的数值,当然也可以继续计算出年月日,同理
DateTime d1,d2;
d1=DateTime.Now;
d2=this.dateTimePicker1.Value;
TimeSpan ts= d2-d1;
DateTime d3=new DateTime(ts.Ticks);
MessageBox.Show(string.Format("{0:yyyy年MM月 }", d3));
CMIC(大象) 的方法得出 04年08个月
rferen2003(流水)的方法得出 3年零7个月
正确的为rferen2003(流水)的方法