Created
March 25, 2014 00:37
Converting ISO Date/Time To ColdFusion Date/Time
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<cffunction | |
name="ISOToDateTime" | |
access="public" | |
returntype="string" | |
output="false" | |
hint="Converts an ISO 8601 date/time stamp with optional dashes to a ColdFusion date/time stamp."> | |
<!--- Define arguments. ---> | |
<cfargument | |
name="Date" | |
type="string" | |
required="true" | |
hint="ISO 8601 date/time stamp." | |
/> | |
<!--- | |
When returning the converted date/time stamp, | |
allow for optional dashes. | |
---> | |
<cfreturn ARGUMENTS.Date.ReplaceFirst( | |
"^.*?(\d{4})-?(\d{2})-?(\d{2})T([\d:]+).*$", | |
"$1-$2-$3 $4" | |
) /> | |
</cffunction> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!--- | |
Output the standard ColdFusion date/time stamp | |
for this XML RPC standards compliant ISO 8601 | |
date/time stamp. | |
---> | |
#ISOToDateTime( "19980717T14:08:55" )# |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment