CFLib.org – Common Function Library Project

monthAbbrev(monthNum)

Last updated February 07, 2013

author

Craig Heath

Version: 1 | Requires: CF5 | Library: DateLib

Description:
Pass in a digit (1-12) and get back the equivalent three character calendar month abbreviation.

Return Values:
Returns a locale-specific string representation of the month formatted with mask mmm

Example:

<cfoutput>
    <cfloop from="1" to="12" index="m">
        monthAbbrev(#m#): #monthAbbrev(m)#<br />
    </cfloop>
</cfoutput>

Parameters:

Name Description Required
monthNum The month (1-12) Yes

Full UDF Source:

/**
 * Month number to three character month text abbreviation.
 * v0.9 by Craig Heath
 * v1.0 by Adam Cameron (improved/simplified logic, made locale-aware)
 * 
 * @param monthNum      The month (1-12) (Required)
 * @return Returns a locale-specific string representation of the month formatted with mask mmm 
 * @author Craig Heath (cf.contractor@gmail.com) 
 * @version 1.0, February 7, 2013 
 */
function monthAbbrev(monthnum) {
    return lsDateFormat("01-#monthnum#-01", "mmm"); // the year and the date are insignificant
}

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