using an isDate() on the argument before it gets passed in?
<cfif isDate(myVar)>
#DateTime.DateOutput(myVar)#
<cfelse>
foo
</cfif>
or sure...you could change the type attribute of the cfargument to a
string and do the validation in the function itself.
not sure which would be considered more "proper" :)
On 5/23/06, Phillip Senn <[EMAIL PROTECTED]> wrote:
<cfcomponent displayname="DateTime" output="false">
<cffunction name="DateOutput" returntype="string" hint="I return the date
formatted for output" output="false">
<cfargument name="myDateTime" type="date" required="yes">
<cfset var result = "">
<cfif DateDiff('d','1/1/1900',myDateTime) GT 0>
<cfset result = DateFormat(myDateTime,"yyyymmdd")>
</cfif>
<cfreturn result>
</cffunction>
This works fine, except it doesn't accept an empty myDateTime.
So I suppose I need to change type="date" to type="string".
But then I'll need to verify that myDateTime is either "" or a valid date.
----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email to
[email protected] with the words 'unsubscribe cfcdev' as the subject of the
email.
CFCDev is run by CFCZone (www.cfczone.org) and supported by CFXHosting
(www.cfxhosting.com).
An archive of the CFCDev list is available at
www.mail-archive.com/[email protected]
--
Charlie Griefer
================================================
"...All the world shall be your enemy, Prince with a Thousand Enemies,
and whenever they catch you, they will kill you. But first they must catch
you, digger, listener, runner, prince with a swift warning.
Be cunning and full of tricks and your people shall never be destroyed."
----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email to
[email protected] with the words 'unsubscribe cfcdev' as the subject of the
email.
CFCDev is run by CFCZone (www.cfczone.org) and supported by CFXHosting
(www.cfxhosting.com).
An archive of the CFCDev list is available at
www.mail-archive.com/[email protected]