日期:2014-05-18  浏览次数:20405 次

有一个日期格式的值如何换成另一种格式
例如
2007-7-7
我想改成
2007年7月7日

------解决方案--------------------
try

DateTime dt = DateTime.Parse( "2007-7-7 ");
string result = dt.ToString( "yyyy年M月d日 ");
------解决方案--------------------
string ss = datetime.ToString();
int index = ss.indexof( "- ");
string year = ss.substring(0,index);
string otherString = ss.substring(index,ss.length - index);
...按上面的。然后组合成就可以了。



---------------------------------------------
EMail:bdbox@163.com 请给我一个与您交流的机会!
------解决方案--------------------
试试
date.ToString( "yyyy年M月d日 ", DateTimeFormatInfo.InvariantInfo)