ZF-4849: add a format to output measures

Issue Type: New Feature Created: 2008-11-07T04:53:26.000+0000 Last Updated: 2012-11-20T20:52:40.000+0000 Status: Closed Fix version(s): Reporter: Marc Bennewitz (GIATA mbH) (mben) Assignee: None Tags: - Zend_Measure

Related issues: Attachments:


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:

<pre class="highlight">

method can be:

<pre class="highlight">
toString(int $round, $locale=null) : string
toString(string $format, $locale=null) : string

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

<pre class="highlight">
$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)


Posted by Thomas Weidner (thomas) on 2008-11-10T04:31:41.000+0000

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

Posted by Marc Bennewitz (GIATA mbH) (mben) on 2008-11-10T05:01:58.000+0000

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 ?

Posted by Rob Allen (rob) on 2012-11-20T20:52:40.000+0000

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.

Have you found an issue?

See the Overview section for more details.


© 2006-2018 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.