CFLib.org – Common Function Library Project

date2ExcelDate(Date to format)

Last updated May 5, 2016

author

Kevin Cotton

Version: 1 | Requires: CF6 | Library: DateLib

Description:
Return the 'Date' format that Excel demands which is, in fact, a numeric representation of a date created by the difference in the number of days, between the date in question and Dec. 31, 1899

Return Values:
Returns a number.

Example:

<cfoutput>#date2ExcelDate(now())#</cfoutput>

Parameters:

Name Description Required
Date to format dateString Yes

Full UDF Source:


function date2ExcelDate(dateString) {
	var rtrnString = '';
	if(isDate(dateString)) {
		return dateDiff("d", createDate( 1899,12,30 ), dateString);
	};
				
	return rtrnString;
};
blog comments powered by Disqus

Search CFLib.org


Latest Additions

Kevin Cotton added
date2ExcelDate
May 5, 2016

Raymond Camden added
CapFirst
April 25, 2016

Chris Wigginton added
loremIpsum
January 18, 2016

Gary Stanton added
calculateArrival...
November 19, 2015

Sebastiaan Naafs - van Dijk added
getDaysInQuarter
November 13, 2015

Created by Raymond Camden / Design by Justin Johnson