文章作者 : 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>
|