CFLib.org – Common Function Library Project

date2ExcelDate(dateString)

Last updated May 05, 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
dateString Date to format Yes

Full UDF Source:

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

Search CFLib.org


Latest Additions

Raymond Camden added
QueryDeleteRows
November 04, 2017

Leigh added
nullPad
May 11, 2016

Raymond Camden added
stripHTML
May 10, 2016

Kevin Cotton added
date2ExcelDate
May 05, 2016

Raymond Camden added
CapFirst
April 25, 2016

Created by Raymond Camden / Design by Justin Johnson