ISODateToTS(str)
Last updated September 21, 2004
Version: 1 | Requires: ColdFusion 5 | Library: DateLib
Description:
Takes a text string of an ISO date and converts it to a datetime object. This is useful when parsing an RDF or RSS feed that uses Dublin Core or otherwise uses ISO formatted dates. Strips the date time down to the hour and minute, omitting seconds (as some feeds do not use seconds). Please note that the tiem zone is ignored.
Return Values:
Returns a date.
Example:
<CFSET theDateTime = ISODateToTS(theISODateString)>
<CFOUTPUT>
The ISO date string in text form: #theISODateString#<br>
The date and time: #dateformat(thedatetime, "m.dd.yyyy.")# #timeformat(thedatetime, "hh:mm tt")#<br>
</CFOUTPUT>
Parameters:
| Name | Description | Required |
|---|---|---|
| str | ISO datetime string to parse. | Yes |
Full UDF Source:
<cfscript>
/**
* Converts text string of ISO Date to datetime object; useful for parsing RSS and RDF.
*
* @param str ISO datetime string to parse. (Required)
* @return Returns a date.
* @author James Edmunds (jamesedmunds@jamesedmunds.com)
* @version 1, September 21, 2004
*/
function ISODateToTS(str) {
return ParseDateTime(ReplaceNoCase(left(str,16),"T"," ","ALL"));
}
</cfscript>
Search CFLib.org
Latest Additions
Shawn Porter added
DeMoronize
2 hour(s) ago
Chris Carey added
readPropertiesFi...
1 day(s) ago
Randy Johnson added
lastDayofWeek
3 day(s) ago
Frank Marion added
sitemapPing
7 day(s) ago
Top Rated
QuickSort
Rated 5.0, 3 time(s)
indentXml
Rated 5.0, 3 time(s)
queryColumnsToSt...
Rated 5.0, 3 time(s)
generateSsccAsn
Rated 5.0, 3 time(s)