[thelist] PHP Generate a reference number

Ben Henick persist1 at io.com
Thu Jan 16 08:49:18 CST 2003

On Thu, 16 Jan 2003, Andrew Maynes wrote:

> What I would like to do is generate a ref number based on time dd/mm/yyyy can
> this be done?

Yes.  I personally have always found it easier to work with timestamps,

$reference_num_secs = time();
$reference_num_date = date("ymdHis",$reference_num_secs);

The latter returns, for example:


in other words:

16 Jan 2003 15:45:42 -0000

(One subs an upper case "Y" for the lower-case in order to return a four
digit year, IIRC.)

Ben Henick                     "In the long run, men hit only what they aim
Web Author At-Large             at.  Therefore, though they should fail
http://www.io.com/persist1/     immediately, they had better aim high."
persist1 at io.com                 -- Henry David Thoreau

More information about the thelist mailing list