– Common Function Library Project


Last updated May 13, 2003


Nathan Dintenfass

Version: 1 | Requires: CF6 | Library: DateLib

If you are a U.S. developer who has end users in other parts of the world, you may have run into the fact that they write dates with the day before the month, whereas Americans write the month before the day. This function takes a "European-style" date and makes it a "U.S.-style" dateTime string.

Return Values:
Returns a date string.


<cfset theDate = "05/02/2003">
original date string ("dd/mm/yyyy"): #theDate#
<br /><br />
what CF thinks that is on an American machine: #parseDateTime(theDate)#
<br /><br />
what it should be, after using parseEuroDate: #parseEuroDate(theDate)#


Name Description Required
euroDate Date string. Yes

Full UDF Source:

 * Makes a &quot;European&quot; date (day before month) into a U.S. style date.
 * @param euroDate 	 Date string. (Required)
 * @return Returns a date string. 
 * @author Nathan Dintenfass ( 
 * @version 1, May 13, 2003 
function parseEuroDate(euroDate){
	//grab the old locale, so we can switch it back
	var oldLocale = getLocale();
	//a var to hold our dateTime
	var dateTime = "";
	//set the locale to British -- they use the Euro format!
	setLocale("English (UK)");
	//parse it using the localization function for parsing date time
	dateTime = LSParseDateTime(arguments.euroDate);
	//now set the Locale back, so we don't mess up the server
	//return our dateTime that was parsed
	return dateTime;
blog comments powered by Disqus


Latest Additions

Kevin Cotton added
May 5, 2016

Raymond Camden added
April 25, 2016

Chris Wigginton added
January 18, 2016

Gary Stanton added
November 19, 2015

Sebastiaan Naafs - van Dijk added
November 13, 2015

Created by Raymond Camden / Design by Justin Johnson