CFLib.org – Common Function Library Project

isRFC3339(input)

Last updated February 8, 2010

Version: 1 | Requires: ColdFusion MX | Library: DateLib

 
Rated 0 time(s). Average Rating: 0

Description:
Compares a date/time string and validates it against the RFC 3339 - Date and Time on the Internet: Timestamps protocol. Its use is a requirement for all date/time values contained within Atom 1 feeds which is supported by CF8's CFFEED tag.

Return Values:
Returns a boolean.

Example:

view plain print about
#IsRFC3339('1999-01-31T00:01:43.05-23:00')#

Parameters:

Name Description Required
input String to check. Yes

Full UDF Source:

view plain print about
<cfscript>
/**
 * Compares a date/time string and validates it against the RFC 3339 - Date and Time on the Internet: Timestamps protocol.
 * 
 * @param input      String to check. (Required)
 * @return Returns a boolean. 
 * @author Ben Garrett (bengarrett@civbox.org) 
 * @version 1, February 8, 2010 
 */

function isRFC3339(input) {
    return YesNoFormat(REFindNoCase('^(19|20)\d\d-(0[1-9]|1[0-2])-([0-2]\d|3[0-1])T([0-1]\d|2[0-4]):([0-5]\d):([0-5]\d)(.\d\d)?(Z|[\+|-]([0-1]\d|2[0-4]):([0-5]\d))$',input));
}
</cfscript>
blog comments powered by Disqus

Search CFLib.org


Latest Additions

Tayo Akinmade Tayo Akinmade added
arrayTrim
3 day(s) ago

Will Belden Will Belden added
longTime
9 day(s) ago

James Sleeman James Sleeman added
quickSort
19 day(s) ago

Ben Forta Ben Forta added
GetHostAddress
22 day(s) ago

Top Rated

Darwan Leonardo Sitepu EksporSQLData
Rated 5.0, 16 time(s)

Darwan Leonardo Sitepu backupDatabase
Rated 5.0, 13 time(s)

Barney Boisvert indentXml
Rated 5.0, 10 time(s)

Kevin Pepperman generateSsccAsn
Rated 5.0, 4 time(s)

Created by Raymond Camden / Design by Justin Johnson