Issues

ZF-4849: add a format to output measures

Description

I would like to output some measures in an own format: e.g: I get the time "485500 ms" and would output it as "8 min 05 s"

A format code can be:


[:.:]

method can be:


toString(int $round, $locale=null) : string
toString(string $format, $locale=null) : string

examples: -> higher values will sub from the original value


$time = new Zend_Measure_Time(57500,Zend_Measure_TIME::MILLISECOND);
echo $time->toString('[minute:1.0:3] [second:2.0:1]');  // 8 min 05 s
// [minute:1.0:3] -> 8 min    (485500ms - 8min = 5.5s)
// [second:2.0:1] -> 05 s min (5.5s - 5s = 500ms)

echo $time->toString('[minute:2.0:1] [second:1.2:3]');  // 08 m 05.50 sec
// [minute:2.0:1] -> 08 m
// [second:1.2:3] -> 05.50 sec

echo $time->toString('[minute]:[second:2].[millisecond:3] [minute:0.0:N]');  // 8:05.500 minutes
// [minute]        -> 8
// [second:2]      -> 05
// [millisecond:3] -> 500
// [minute:0.0:N]  -> minutes (0.0 means no value | N means the full name)

Comments

This is really very complicated, don't you think so ?

Hi Thomas

Yes the format string is very complicated but I don't know a better format structure to create a way to display the measure in different formats. A standard similar to the date format I can't find.

Do you have a other idea to display measures in different formats ?

Bulk change of all issues last updated before 1st January 2010 as "Won't Fix".

Feel free to re-open and provide a patch if you want to fix this issue.