Archive | Tutorials RSS feed for this section

PHP Number Leading Zero’s

<?php $id = 3; echo sprintf(“%04d”,$id); //result 0003 ?>

Read more

PostgreSQL Calculate Age From Birthdate

SELECT EXTRACT(year from AGE(NOW(), ’1985-08-21′)) as “age”;

Read more

Javascript Round Number function

function round_number(n, d) { n = n – 0; if (d == null) d = 2; var f = Math.pow(10, d); n += Math.pow(10, – (d + 1)); n = Math.round(n * f) / f; n += Math.pow(10, – (d + 1)); n += ”; return d == 0 ? n.substring(0, n.indexOf(‘.’)) : n.substring(0, n.indexOf(‘.’) [...]

Read more