How To Convert UNIX Timestamps to Date using PHP CLI

Author: , August 15th, 2015

For a quick visual check to see what the human-readable date is based on a UNIX timestamp integer: php -r ‘print date(“r”,1483228799);’ php -r ‘print strtotime(“1 Jan 2015″) – 1;’

How To Round And Format Numbers In JavaScript

Author: , September 23rd, 2012

1 2 3 4 5 var num = 10; var result = num.toFixed(2); // result will equal 10.00   var num= 170.2305; var result = num.toFixed(3); // result will equal 170.231 var num = 10; var result = num.toFixed(2); // result will equal 10.00 var num= 170.2305; var result = num.toFixed(3); // result will equal […]

How To Format Numbers Using PHP Or Smarty

Author: , December 1st, 2011

PHP number_format($number, 2, ‘.’, ‘,’); SMARTY {$number|number_format:2:”.”:”,”}

How To Format The Number Of Decimal Places In Perl

Author: , October 10th, 2011

1 2 my $number = 123.45; printf("%.3f", $number); my $number = 123.45; printf(“%.3f”, $number); Outputs: 123.450

How To Round Up A Number In Perl

Author: , October 10th, 2011

To round up to the nearest 5: 1 2 use Math::Round qw(nhimult); $roundedUpNumber  = nhimult( 5, $originalNumber ); use Math::Round qw(nhimult); $roundedUpNumber = nhimult( 5, $originalNumber ); http://search.cpan.org/dist/Math-Round/Round.pm To round up to the nearest 1: Cross-posted from PerlMonks: 1 2 3 4 sub roundUp {     my $n = shift;     return( $n […]