当前位置:首页
开发技术指南» 文章正文
    引言:

 ·高手进来    »显示摘要«
    摘要: 请问怎样才能学好c、c++? ......
    摘要: str:=select * from renyuan where (dwbh<>03) order by rybh; with adoquery do begin sql.text := str; open; first; while not eof do begin vitem := rzlistview1.items.add; vitem.caption :=adoquer......


格式化字符串

str="0506271530"  
  如何将str格式化成"2005-06-27   15:30"日期时间形式,谢谢!!

NO.1   作者: helloworld84

Public   Function   FormatToDateTime(ByVal   str   As   String)   As   String  
   
                  Dim   str1(5)   As   String  
   
                  str1(0)   =   Mid(str,   1,   2)  
                  str1(1)   =   Mid(str,   3,   2)  
                  str1(2)   =   Mid(str,   5,   2)  
                  str1(3)   =   Mid(str,   7,   2)  
                  str1(4)   =   Mid(str,   9,   2)  
   
                  str   =   "20"   &   str1(0)   &   "-"   &   str1(1)   &   "-"   &   str1(2)   &   "   "   &   _  
                                  str1(3)   &   ":"   &   str1(4)  
   
          End   Function

NO.2   作者: liym15

// str="0506271530"  
  //如何将str格式化成"2005-06-27   15:30"日期时间形式,谢谢!!  
  string   str="0506271530";  
  string   date;  
  string   year,month,day,time,ser;  
  year=str.Substring(0,2);  
  month=str.Substring(2,2);  
  day=str.Substring(4,2);  
  time=str.Substring(6,2);  
  ser=str.Substring(8,2);  
  date="20"+year+"-"+month+"-"+day+"   "+time+":"+ser;


 ·how to use tables     »显示摘要«
    摘要: how to use tables ? ......
» 本期热门文章:
· 热门栏目:
» 相关精选文章
» 其它相关:

©2000-2007 All Rights Reserved. 最佳浏览:1024X768 MSIE