;中国 COLD FUSION 用户组; WWW.CFWINDOW.COM 
您的位置 :首页 >> CF 技巧文章 >> 阅读文章内容 [ 关闭窗口 ]      

技巧文章内容 
    将英式日期转化为美式日期格式
文章作者 : Linkfoxo [ linkfoxo@yahoo.com ]          Web URL : http://
上载日期 : 2000-11-23

经常在做项目的时候发现,明明是7月1号,结果却存储为1月7号这是由于日期格式搞错的缘故。

相信以下文章会对您有所帮助。

I have been asked several times, how can I convert date order.
EXAMPLE:  

(Day, Month, Year
to
Month, Day, Year)

========================== New ================================
Here is the Same Tips as last week but a simple
change.

<CFSET USDate = DateFormat(ParseDateTime(UKDate),
"mm/dd/yyyy")>
========================== New ================================

Here is the code that will handle this.

<cfset newlist="0">
<cfset UKDatelist="10/11/00,6/12/00,8/11/00">
<cfloop list="#UKDatelist#" index="UKDate">
========================== New ================================
<CFSET USDate = DateFormat(ParseDateTime(UKDate),
"mm/dd/yyyy")>
========================== New ================================
<cfset NewList=NewList &","&"#USDate#">
</cfloop>

<cfset NewList=#ListDeleteAt(#NewList#, 1)#>
<cfoutput>
<p><b>Org Date:</b><br>
#UKDatelist#
<p><b>New Date:</b><br>
#newlist#
</cfoutput>







< 联系我们 --- 中国Cold Fusion用户组>

CFUG 国内(总部):Linkfoxo    上海:CFANS    北京:Cafe,Cyberkid,liwater    沈阳:Wangking
  
哈尔滨:Baiming    浙江:梅盛松    江西:陈末
  
CFUG (国际) Nagoya(名古屋):Codeguru    新加坡:YUZI    新西兰(Auckland):Richard CHEN
Copyright 2000-2001 www.cfwindow.com.All rights reserved

;中国 COLD FUSION 用户组; WWW.CFWINDOW.COM