CFLib.org – Common Function Library Project

DateLib

Last updated May 5, 2016 / 186 Released UDF(s)
AgeSinceDOB

Given the date of birth, returns age. | Requires: CF5

ago

Displays how long ago something was. | Requires:

BusinessDaysAdd

Works just like dateAdd(), except it only adds business days | Requires: CF5

businessDaysBetween

Calculates the number of business days between 2 dates. | Requires: CF5

calculateArrivalDate

Calculate arrival date for a package. | Requires: CF10

CFChartDateFormat

Formats a date/time value for use on the y-axis in CFCHART. | Requires: CF5

ChineseZodiac

Returns the Chinese Zodiac animal corresponding to the given year of birth. | Requires: CF5

composeDateTime

Creates a date time from optional date parts | Requires: CF9

containsLeapYear

Function that determines if a given date range contains a leap year. | Requires: CF5

convertActiveDirectoryTime

Converts Active Directory 100-Nanosecond time stamps. | Requires: CF6

ConvertLegalHours

Function that returns legal billing time from standard time format. | Requires: CF5

convertSecondsToTimeString

Takes a time in seconds argument and converts to a time string in "4d 12h 30m" format. | Requires: CF9

convertTimeStringToSeconds

Takes a time string in "4d 12h 30m" format and converts to seconds. | Requires: CF9

countArbitraryDays

Returns the number of specific days between a start and end date - i.e. weekdays or workdays. | Requires: CF5

countArbitraryDaysExcluding

Returns the number of days between a start and end date, excluding a specified list of days, and allowing for an exclusion list | Requires: CF5

createCalendar

A simple CFML calendar. | Requires: CF8

CreateDateRange

Creates a date range array. | Requires: CF5

CreateTimeStruct

Converts a given number of days, hours, minutes, OR seconds to a struct of days, hours, minutes, AND seconds. | Requires: CF5

customWeekNumber

Returns week number based on [optional] custom start of week day | Requires: CF5

dailyBusinessReportDateRange

Returns a time range for a particular date from midnight to 11:59:59 the same day except for Monday. | Requires: CF5

date2ExcelDate

Return a date number for Excel columns. | Requires: CF6

date2Timestamp

Converts ColdFusion date to linux timestamp. | Requires: CF5

DateConvertISO8601

Convert a date in ISO 8601 format to an ODBC datetime. | Requires: CF5

DateConvertZ

Similar to DateConvert, but provides local2zone and zone2local conversion from one time zone to another. | Requires: CF5

dateLetters

Add's the st,nd,rd,th after a day of the month. | Requires: CF5

datePatternMatch

Determine if a date string is in a particular pattern | Requires: CF9

DateRangeFormat

Format a range of dates ("August 3 - 11, 2003"). | Requires: CF6

dateRangesOverlap

Compares two date ranges to determine if they overlap by one or more days. | Requires: CF6

DateTimeFormat

Calls both DateFormat and TimeFormat on a data object. | Requires: CF5

DayAsString

Returns a string for a day value. | Requires: CF5

dayOfWeekAsInteger

Converts a day string to a number. | Requires: CF9

dayOfYearReverse

This is the opposite of CFs DayOfYear function. | Requires: CF6

DaysTilBirthday

Returns number of days until your next birthday. | Requires: CF5

DaysTilChristmas

Returns an integer of the days left before Christmas. | Requires: CF5

decade

Returns the decade (xxx0-xxx9) to which the specified year belongs. | Requires: CF6

decimal2Time

Converts decimal to time. | Requires: CF5

DifferentDay

Check if two dates refer to the same day. | Requires: CF5

DifferentMonth

Check if two dates refer to the same month. | Requires: CF5

Duration

Duration(dateObj1, dateObj2) Takes two date objects and returns a structure containing the duration of days, hours, and minutes. | Requires: CF5

EpochTimeToDate

Converts a UNIX epoch time to a ColdFusion date object. | Requires: CF5

EpochTimeToLocalDate

Converts Epoch time to a ColdFusion date object in local time. | Requires: CF5

firstDayOfWeek

Analogous to firstDayOfMonth() function. | Requires: CF9

firstXDayOfMonth

Returns a date object of the first occurrence of a specified day in the given month and year. | Requires: CF9

flattenXmlToStruct

Converts an XML Object into a single flattened struct. | Requires: CF8

GetAscension

Returns the date for Ascension in a given year. | Requires: CF5

GetAshWednesday

Returns a date for Ash Wednesday in a given year. | Requires: CF5

getBegOfDayTS

A function which returns a Beginning Of Day TimeStamp. For example, 1/1/2000 10:30 PM returns {ts '2000-01-01 00:00:00'}. | Requires: CF5

getCfDateTimeFromW3DateTime

Takes a W3 date and returns a CF datetime. | Requires: CF6

GetChristmasDay

Returns the date for Christmas day in a given year. | Requires: CF5

GetColumbusDay

Returns a date for Columbus Day in a given year. If no year is specified, defaults to the current year. | Requires: CF5

GetCorpusChristi

Returns the date for Corpus Christi in a given year. | Requires: CF5

GetCurrentAge

This UDF uses a persons birthdate to output their current age in years. | Requires: CF5

getCurrentFinYear

Returns the current two-part financial year in a specified format. | Requires: CF5

getCurrentGradYear

Gets the current graduation year/end of school year. | Requires: CF5

GetDateFromJulianDay

Calculates the date and time from a provided Julian Day value. | Requires: CF5

GetDateFromModifiedJulianDay

Calculates the date and time based on a modified Julian Day. | Requires: CF5

getDaylightSavingTimeEnd

Returns the date for the End of Daylight Saving Time for a given year. | Requires: CF5

getDaylightSavingTimeStart

Returns the date for The start of Daylight Saving Time for a given year. | Requires: CF5

getDaysInQuarter

Returns the number of days in the current quarter. | Requires: CF5

GetEaster

Returns the date for Easter in a given year. | Requires: CF5

GetElectionDay

Returns a date for Election Day in a given year | Requires: CF5

getEndOfDayTS

A function which returns a End Of Day TimeStamp. For example, 1/1/2000 returns {ts '2000-01-01 23:59:59'}. | Requires: CF5

GetEpochTime

Returns the number of seconds since January 1, 1970, 00:00:00 | Requires: CF5

GetEpochTimeFromLocal

Returns the number of seconds since January 1, 1970, 00:00:00 (Epoch time). | Requires: CF5

getEveryDOW

Returns every occasion of a day of the week. A list of days of the week can be used. | Requires: CF5

getEveryNthDay

determine every nth day of week for a given year. | Requires: CF5

GetFathersDay

Return a date for Father's Day in a given year. If no year is specified, defaults to the current year. | Requires: CF5

GetFederalFiscalYear

Returns the Federal Fiscal Year for a given date. | Requires: CF5

GetFirstDateinQuarter

Gets the first date in a given quarter. | Requires: CF5

getFirstDateThisQuarter

Returns a date object with the first date of the current quarter. | Requires: CF5

getFiscalYear

Returns fiscal year for a date | Requires: CF5

GetGoodFriday

Returns the date for Good Friday in a given year. | Requires: CF5

GetHalloween

Returns a date for Halloween of a given year. | Requires: CF5

GetInaugurationDay

Returns the date for Inauguration Day | Requires: CF5

GetIndependenceDay

Returns the date for U.S. Independence Day in a given year. | Requires: CF5

getIsoTimeString

Converts your date into a time string the aheres to the ISO 8601 standard (for use with some API calls). | Requires: CF9

GetJulianDay

Calculates the Julian Day for any date in the Gregorian calendar. | Requires: CF5

GetLaborDay

Returns a date for Labor Day in a given year. If no year is specified, defaults to the current year. | Requires: CF5

GetLastDateinQuarter

Gets the last date in a given quarter. | Requires: CF5

GetLastOccOfDayInMonth

Returns the day of the month(1-31) of Last Occurrence of a day (1-sunday,2-monday etc.) in a given month. | Requires: CF5

GetMardiGras

Returns the date for Mardi Gras of a given year. | Requires: CF5

GetMemorialDay

Returns a date for Memorial Day in a given year. | Requires: CF5

getMeridiem

I return the "am/pm" portion of a date/time (aka the "meridiem"). | Requires: CF9

GetMLKDay

Returns a date that Martin Luther King Day occurs on in a given year. | Requires: CF5

GetModifiedJulianDay

Calculates the modified Julian Day for any date in the Gregorian calendar. | Requires: CF5

GetMothersDay

Returns a date for Mother's day in a given year. If no year is specified, defaults to the current year. | Requires: CF5

GetNearestHalfHour

Returns the nearest half hour based on minutes of the hour supplied to the function. | Requires: CF5

GetNewYearsDay

Returns a date for New Years Day of a given year. | Requires: CF5

GetNewYearsEve

Returns a date for New Year's Eve for a given year. | Requires: CF5

getNorthAmericanTimeStamp

I convert the server date/time to any North American timezone date/timestamp. | Requires: CF6

GetNthOccOfDayInMonth

Returns the day of the month(1-31) of an Nth Occurrence of a day (1-sunday,2-monday etc.)in a given month. | Requires: CF5

GetPalmSunday

Returns the date for Palm Sunday in a given year. | Requires: CF5

getPascha

Returns the date for Orthodox Easter (Pascha) in a given year. | Requires: CF6

GetPentecost

Returns the date for Pentecost in a given year. | Requires: CF5

GetPresidentsDay

Returns the date for President's Day in a given year. | Requires: CF5

getQuarters

Returns first and last day of quarter from first year to current quarter from array of years. | Requires: CF6

GetQuinquagesima

Returns the date for Quinquagesima in a given year. | Requires: CF5

GetRogationSunday

Returns the date for Rogation Sunday in a given year. | Requires: CF5

GetSeason

Returns season for given date. | Requires: CF5

getSecondsFromTime

Returns the total number of seconds from midnight for a valid date/time object. | Requires: CF5

GetSeptuagesima

Returns the date for Septuagesima in a given year. | Requires: CF5

GetShift

Returns the work shift for a sequence based work schedule. | Requires: CF5

GetSpanDate

Adds a timespan to a date. GetSpanDate(dateObj, days, hours, minutes, seconds) Pass in a date object, with the span difference of days, hours, minutes, and seconds and returns a timestamp of the end of the span. | Requires: CF5

GetThanksgivingDay

Returns the date for Thanksgiving day in a given year. | Requires: CF5

GetTimeFromMinutes

Calculates time from minutes after midnight. | Requires: CF5

getTimeFromSeconds

Calculates time from seconds after midnight. | Requires: CF5

getTimeInterval

Returns the interval since a date in a Twitter like format (e.g. 5 minutes ago) | Requires: CF9

GetTimeStampFromHttpTimeString

Converts HttpTimeString into a timestamp string. | Requires: CF5

getTimeZone

Returns the Time Zone Code (string) that corresponds to the dateTime passed in. | Requires: CF5

GetTrinitySunday

Returns the date for Trinity Sunday in a given year. | Requires: CF5

GetValentinesDay

Returns the date for Valentines Day in a given year. | Requires: CF5

GetVeteransDay

Returns a date for Veterans Day in a given year. | Requires: CF5

GetWeekdays

Returns an array of weekdays. | Requires: CF7

getWeekEnding

Returns an array of dates with the week ending date of each week in the month. | Requires: CF5

getWeekOfMonth

Returns the week number in a month for any given date (1-5). | Requires: CF10

getZodiacSign

Given a date, returns the appropriate zodiac sign. | Requires: CF5

GMTDateFormat

This function takes a date time object and an offset, and outputs a GMT date/time formatted string. | Requires: CF5

goldenBirthday

Returns a 'golden birthday', or the date when your birthday day of month equals your age. | Requires: CF6

hourRound

Rounds a decimal number (hours) to the nearest quater hour. | Requires: CF5

hoursMinutes

Formats a number of minutes into "XX hours XX minutes". | Requires: CF5

HoyToHour

Converts hour of the year to hour of the day. | Requires: CF5

iCalUS

Pass a formatted structure containing the event properties and get back a string in the iCalendar format (correctly offset for daylight savings time in U.S.) that can be saved to a file or returned to the browser with MIME type="text/calendar". | Requires: CF5

IsDateBetween

Returns True if the date provided in the first argument lies between the two dates in the second and third arguments. | Requires: CF5

isDateList

Checks if a list consists of date values only. | Requires: CF5

ISODateToTS

Converts text string of ISO Date to datetime object; useful for parsing RSS and RDF. | Requires: CF5

ISODayOfWeek

Returns the ordinal for the day of the week for the specified date/time object according to ISO standards. | Requires: CF5

isOldEnough

Determine whether a date of birth exceeds minimum age requirement. | Requires: CF5

ISOWeek

Returns the weeknumber according to the ISO standard. | Requires: CF5

ISOYear

Returns the ISO correct year of a given date, necessary for dates from 29th Dec to 3rd Jan. | Requires: CF5

isRFC3339

Compares a date/time string and validates it against the RFC 3339 - Date and Time on the Internet: Timestamps protocol. | Requires: CF6

IsSQLServerDate

Validates a string as valid datetime or smalldatetime string for SQL Server. | Requires: CF5

isTime

Validates if a string is a valid time in 12- or 24-hour format | Requires: CF6

isTimeBetween

Returns true/false if a time is between the supplied start/end times. | Requires: CF6

isUsefulDate

Tests if a date is valid, and within a century of today. | Requires: CF5

IsWeekday

Returns true if a date is during the week. | Requires: CF5

IsWeekend

Returns true if a date is on the weekend. | Requires: CF5

JulianDayofWeek

Returns the day of the week for a date in the Julian calendar. | Requires: CF5

lastBusinessDay

Returns a date object representing the last Business day of the given month | Requires: CF5

LastDayOfMonth

Returns a date object representing the last day of the given month. | Requires: CF5

lastDayofWeek

Returns last day of the week, assumes Saturday is the last day. | Requires: CF5

LastMonth

Returns a date object representing the first day of the previous month. | Requires: CF5

LocalTime

Function that returns adjusted local server time. | Requires: CF6

longTime

Returns a list like 3 years, 2 months, 12 days, 1 hour, 10 minutes, 45 seconds from a seconds count argument. | Requires: CF8

LSShortDateFormat

Return a date in a locale-specific short form. | Requires: CF5

MakeDateSelectLists

Creates pulldowns for month, day and year. | Requires: CF5

MaxDate

Returns larger of 2 dates. | Requires: CF5

MDYAsString

Returns a date in long text format. | Requires: CF5

millisecondsToDate

Converts epoch milleseconds to a date timestamp. | Requires: CF6

MinDate

Returns smaller of 2 dates. | Requires: CF5

minutesToUtcOffset

Converts minutes to UTC Offset in the specified format. | Requires: CF10

monthAbbrev

Month number to three character month text abbreviation. | Requires: CF5

MsToSec

Converts milliseconds to seconds. | Requires: CF5

NextMonth

Returns a date object representing the first day of the next month. | Requires: CF5

NextOccOfDOW

Returns a date object representing the next occurrence of the specified day. The default is the next occurrence of the current day. | Requires: CF5

nowTimestamp

Returns current time from year to milliscend in a purely numerical format. | Requires: CF6

offsetDate

Offset a date according to a datepart defined by a mask. | Requires: CF9

parseCMSDatetime

Parses a CMS (SVN or CVS) datetime into a CF datetime object. | Requires: CF5

parseEuroDate

Makes a "European" date (day before month) into a U.S. style date. | Requires: CF6

parseGeneralizedTimeString

Creates a date/time object from a generalized time string in the format of YYYYMMDDHHMMSS.0Z | Requires: CF5

PrevOccOfDOW

Returns a date object representing the previous day specified. The default is one week prior to the current day. | Requires: CF5

QualitativeDate

Qualitative description of a date. | Requires: CF5

QuarterHour

Returns a string with a mixed fraction of quarters. | Requires: CF5

secondsToEnglish

Converts seconds to nearest time unit in english. | Requires: CF5

secsToTime

Takes number of seconds as input and returns a formatted string representation of that duration (weeks/days/hours/mins/secs). | Requires: CF5

ShortDateMask

Generates a mask for a short date based on the locale. | Requires: CF5

splitDateSpanToDays

Splits date span to array of days (periods) | Requires: CF5

stringHours

Formats a number of minutes into into a nicely formatted string. | Requires: CF6

SwatchIT

Returns the current internet time. | Requires: CF5

TextToDate

cffunction that takes a text string and a format and returns a date object. | Requires: CF6

thisMonth

Returns structure containing month information. | Requires: CF6

ThisWeek

Generates a structure of days for the week, including the beginning and end of the week. | Requires: CF5

timeRoundUpToNextSecond

corrects rounding errors for times brought in from Excel | Requires: CF5

timeZoneNow

Show the current date/time for a given time zone. | Requires: CF9

Tomorrow

Returns a date object representing tomorrow. | Requires: CF5

toSeconds

Converts a duration of time to seconds. | Requires: CF5

totalTimeFromSec

Get total time from seconds in hh:mm:ss format | Requires: CF5

TurkishDateFormat

Display date in Turkish language and Turkish date format. | Requires: CF5

utcOffsetToMinutes

Converts UTC Offset to minutes. | Requires: CF10

Weekdays

Returns the number of weekdays between two dates. | Requires: CF5

WeekInMonth

Returns the week number in a month. | Requires: CF5

weekNumsInMonth

Returns the week numbers in a given month of a given year. | Requires: CF5

WeekStartDate

Takes a week number and returns a date object of the first day of that week. | Requires: CF5

XSDDateFormat

Takes an Date/Time and makes it into XSD time format (for use in xml xsds) | Requires: CF5

yearAsString

Returns a string representation of the numeric year passed into it. | Requires: CF5

Yesterday

Returns a date object representing yesterday. | Requires: CF5

zDateFormat

Formats the given date as a Zulu date. | Requires: CF6

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