您的位置:程序门 -> vb -> 基础类



日期型转换问题,急!


[收藏此页] [打印本页]选择字色:背景色:字体:[][][]


日期型转换问题,急!
发表于:2007-09-05 10:45:21 楼主
我想把22.08.2007转换成2007-08-22这样的日期型格式,有什么方法,请各位指教下!
发表于:2007-09-05 11:30:271楼 得分:0
dim   datx     as   date,str$
str= "22.08.2007 "
str=replace(str, ". ", "/ ")
str=replace(str, "。 ", "/ ")
datx=formatdatetime(str,1)

debug.print   datx    
发表于:2007-09-05 11:31:182楼 得分:0
用format(date, "yyyy-mm-dd ")
发表于:2007-09-05 11:31:193楼 得分:0
用format(date, "yyyy-mm-dd ")
发表于:2007-09-05 11:31:204楼 得分:0
用format(date, "yyyy-mm-dd ")
发表于:2007-09-05 11:37:415楼 得分:0
我没找到现成的函数。

temp   =   "22.08.2007 "
temp0   =   split(temp,   ". ")
temp   =   temp0(2)   +   "- "   +   temp0(1)   +   "- "   +   temp0(0)
发表于:2007-09-05 11:40:056楼 得分:0
用  format就好
发表于:2007-09-05 11:45:427楼 得分:0
temp= "22.08.2007 "

如果temp是日期格式,那么fromat   函数可以直接使用;
如果temp是字符格式,那么fromat   函数我转换的结果是不正确的;
发表于:2007-09-05 12:36:218楼 得分:0
1楼正解
dim   str
str= "22.08.2007 "
str=replace(str, ". ", "/ ")
str=format(cdate(str), "yyyy-mm-dd ")


快速检索

最新资讯
热门点击