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");
}
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