256
edits
Line 99: | Line 99: | ||
padding("2.40", 6, "left"); // Returns "2.40 " | padding("2.40", 6, "left"); // Returns "2.40 " | ||
padding("1220.40", 6); // Returns "1220.40" | padding("1220.40", 6); // Returns "1220.40" | ||
==== date ==== | |||
''string'' '''date'''(''string'' format[, ''string'' time]); | |||
Returns date and time according to the first argument. The format syntax is the same as PHP's date(). The optional argument may be a timestamp or string with date. | |||
'''Example''' | |||
date("Y-m-d"); // Returns current date e.g. "2007-11-20" | |||
date("H:i:s"); // Returns current time, e.g. "19:50:37" | |||
date("Y-m-d", "1995-10-03T20:30:37"); // Returns date "1995-10-03" | |||
==== precision ==== | |||
''string'' '''precision'''(''number'' value, ''number'' precision); | |||
Returns string containing value with a fixed number of decimals. | |||
'''Example''' | |||
precision(5, 2); // Returns "5.00" | |||
precision(5.25, 1); // Returns "5.2" | |||
precision(5.26, 1); // Returns "5.3" | |||
precision(5.24, 1); // Returns "5.2" |
edits