CFLib.org – Common Function Library Project

nowTimestamp()

Last updated April 25, 2008

author

Alan McCollough

Version: 1 | Requires: CF6 | Library: DateLib

Description:
Returns current time in human-readable yet purely numeric format, that format being YYYYMMDDHHMMSSLLL YYYY=4-digit year MM=2-digit month DD=2-digit day HH=2-digit hour (24 hour format) MM=2-digit minute SS=2-digt second LLL=3-digit milisecond This is useful when you want a string that will alpha-sort by date, or when you want an easy-to-read or at least easy-to-parse timestamp as part of a filename. For example, 20080227154829957 is February 27, 2008, at 3:48 pm and 29.957 milliseconds.

Return Values:
Numeric

Example:

Right now is #nowTimestamp()#

Parameters:

No arguments.

Full UDF Source:

/**
 * Returns current time from year to milliscend in a purely numerical format.
 * 
 * @return Numeric 
 * @author Alan McCollough (amccollough@anmc.org) 
 * @version 1, April 25, 2008 
 */
function nowTimestamp() {
   return dateformat(now(),"yyyymmdd") & timeformat(now(),"HHmmssL");
}

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