I have a page which allows the user to select a custom query and download a
CSV. The relevant code is:
cfsetting enablecfoutputonly=yes
CFHEADER NAME=Content-Disposition VALUE=attachment;
filename=#session.MM_Username##LSTimeFormat(Now(),'hhmmmss')#.csv
CFCONTENT TYPE=application/excel
cfif IsDate(thisfield)
#DateFormat(blahblah)#
cfelse
whatever
/cfif
Would that work?
Will
~|
Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting,
up-to-date ColdFusion information by your peers,
Or maybe you'd needta extract that date out first with a ListFirst()?
cfset dateOnly = ListFirst(thisfield, )
cfif isValid(dateOnly)
Show this
cfelse
show that
/cfif
??
Will
~|
Introducing the Fusion Authority Quarterly
I just slapped myself on my forehead, thank you.
This worked fine:
cfoutput query=rsList
cfloop index=thisfield list=#fieldlist#
cfif IsDate(evaluate(#thisfield#))
#lsdateformat(evaluate(#thisfield#), mm/dd/)#
cfelse
#evaluate(#thisfield#)#
/cfif,
/cfloop#CHR(13)#
/cfoutput
On
Will,
It looks like isDate() will do what you need - to see if the string
can be converted to a date
You might want to look at parseDateTime() which will create a date
object from the date string.. may or may not be of any use
cfset test = 2006-02-11 00:00:00.0
cfoutput#parseDateTime(test)# |
5 matches
Mail list logo