How do I use ZF2 I18n currencyformatter to format bitcoin

+1 vote
Bitcoin allows 8 decimal places (123.45678912).

How can I use ZF2 I18n currency formatter to format a bitcoin amount with the full 8 decimal places instead of just cutting it short to 2 decimal places?
Sep 10, 2018 in Blockchain by slayer
• 29,370 points
488 views

1 answer to this question.

0 votes

From ZF2's documentation at http://framework.zend.com/manual/2.3/en/modules/zend.i18n.view.helpers.html

I found the following link:

http://www.icu-project.org/apiref/icu4c/classDecimalFormat.html#details

If you scroll down to the decimal format and significant digits sections, you'll see the answer. I ended up doing this for my code to represent BTC:

$cur = getCurrency();

$this->plugin("currencyformat")->setCurrencyCode($cur);

if($cur == "BTC"):
    $this->plugin("currencyformat")->setCurrencyPattern('@############### ¤');
endif;

The '@' means display at least one signification digit. The 15 '#'s plus the '@' means the maximum amount of significant digits to show is 16. The '¤' will display the currency at the end of the number.

answered Sep 10, 2018 by digger
• 26,740 points

Related Questions In Blockchain

0 votes
1 answer

How do I use hyperledger fabric blockchain to build my own application?

To use fabric I would recommend you ...READ MORE

answered May 17, 2018 in Blockchain by Johnathon
• 9,090 points
1,075 views
+1 vote
1 answer

Hyperledger - How can I use transaction certificates to enforce privacy?

The transaction certificates don't actually address privacy ...READ MORE

answered Apr 17, 2018 in Blockchain by Perry
• 17,100 points
901 views
0 votes
1 answer

How do I query Blockchain bitcoin locally?

You could use json RPC provided by ...READ MORE

answered Apr 19, 2018 in Blockchain by Christine
• 15,790 points
1,631 views
0 votes
1 answer

How do I send back ethers to the sender of the tokens in a smart contract?

Whenever a smart contract receives ether via ...READ MORE

answered May 30, 2018 in Blockchain by Perry
• 17,100 points
3,601 views
+1 vote
1 answer

Protocols used in a distributed/dlt system for the nodes to establish communication

yes all are over TCP/IP connections secured ...READ MORE

answered Aug 6, 2018 in Blockchain by aryya
• 7,460 points
1,428 views
0 votes
1 answer

Truffle tests not running after truffle init

This was a bug. They've fixed it. ...READ MORE

answered Sep 11, 2018 in Blockchain by Christine
• 15,790 points
1,923 views
0 votes
1 answer

Hyperledger Sawtooth vs Quorum in concurrency and speed Ask

Summary: Both should provide similar reliability of ...READ MORE

answered Sep 26, 2018 in IoT (Internet of Things) by Upasana
• 8,620 points
1,451 views
0 votes
1 answer

How i can use nodejs to watch transactions in bitcoin network?

you can use  const Socket = require('blockchain.info/Socket'); const mySocket ...READ MORE

answered Jul 9, 2018 in Blockchain by digger
• 26,740 points
1,282 views
0 votes
1 answer

How to use bitcoin price as place holder in php?

You can do it by providing an ...READ MORE

answered Aug 21, 2018 in Blockchain by digger
• 26,740 points
927 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP