如何把这样的时间格式:20130523123214000+0800转换成:2013-05-23 12:32:14.000?不许用subString()拼接 如何把这样的时间格式:20130523123214000+0800转换成:2013-05-23 12:32:14.000?不许用subString()拼接 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 string str = @"20130523123214000+0800"; string strmatch = @"([\d]{4})([\d][\d])([\d][\d])([\d][\d])([\d][\d])([\d][\d])"; System.Text.RegularExpressions.Regex reg = new System.Text.RegularExpressions.Regex(strmatch); System.Text.RegularExpressions.Match m = reg.Match(str); string datestr = m.Groups[1].Value + "-" + m.Groups[2].Value + "-" + m.Groups[3].Value+" " +m.Groups[4].Value+":"+m.Groups[5].Value+":"+m.Groups[6].Value; MessageBox.Show(datestr); 楼上的加上这个那就是更完美了,试试看精确到毫秒的: void a() { string str = @"20130523123214125+0800"; string strmatch = @"([\d]{4})([\d][\d])([\d][\d])([\d][\d])([\d][\d])([\d][\d])([0-9]{3})"; System.Text.RegularExpressions.Regex reg = new System.Text.RegularExpressions.Regex(strmatch); System.Text.RegularExpressions.Match m = reg.Match(str); string datestr = m.Groups[1].Value + "-" + m.Groups[2].Value + "-" + m.Groups[3].Value + " " + m.Groups[4].Value + ":" + m.Groups[5].Value + ":" + m.Groups[6].Value+"."+m.Groups[7].Value; MessageBox.Show(datestr); } 为什么我的页面输出respond.write("<script>alert('添加成功');</script>");后 所有字体变大,错位 怎样改变窗体的位置 关于界面设计和数据库的连接实现 一个简单的登录页面出错 怎样代码实现控件的拖放?请各位指教! 谁手上有中文汉字和拼音的对照表,数据库或者文本都可以(UP有分) 急,求好人帮助。aspx通过本地路径下载文件 求几张刀光图片,要底透明动态gif或png 关于单元测试的一个纠结的问题 c#中可以调用DCOM吗?如果可以,怎么调用啊? asp.net中弹出Div,下面的页面变成灰色!并且可以把数据提交! C++代码转换
string str = @"20130523123214000+0800";
string strmatch = @"([\d]{4})([\d][\d])([\d][\d])([\d][\d])([\d][\d])([\d][\d])";
System.Text.RegularExpressions.Regex reg = new System.Text.RegularExpressions.Regex(strmatch);
System.Text.RegularExpressions.Match m = reg.Match(str);
string datestr = m.Groups[1].Value + "-" + m.Groups[2].Value + "-" + m.Groups[3].Value+" "
+m.Groups[4].Value+":"+m.Groups[5].Value+":"+m.Groups[6].Value;
MessageBox.Show(datestr);
void a()
{
string str = @"20130523123214125+0800";
string strmatch = @"([\d]{4})([\d][\d])([\d][\d])([\d][\d])([\d][\d])([\d][\d])([0-9]{3})";
System.Text.RegularExpressions.Regex reg = new System.Text.RegularExpressions.Regex(strmatch);
System.Text.RegularExpressions.Match m = reg.Match(str);
string datestr = m.Groups[1].Value + "-" + m.Groups[2].Value + "-" + m.Groups[3].Value + " " + m.Groups[4].Value + ":" + m.Groups[5].Value + ":" + m.Groups[6].Value+"."+m.Groups[7].Value;
MessageBox.Show(datestr);
}