Date, Time and Money formatting

Hi all,

Is there exists a similar way in PHP to format DATE, TIME and MONEY values based on a locale?

In Javascript, there is a very simple and clean way for this (for example):
DATE: Date.prototype.toLocaleDateString() - JavaScript | MDN
MONEY: Intl.NumberFormat - JavaScript | MDN

I need it for any internationalizations in our projects but I do not want to define all local specific formats manuell.

Best regards,

Check from the PHP Manual

For money I think it does not make sense to use functions. It is handled too differently and depends really what you want to do with the numbers. Just use the standard text functions to format the numbers.

1 Like

Money :money_mouth_face: Format in PHP

try “number_format()” it goes like this;
number_format(number, 2)
the two represents how many decimal places you want and the best part is you can put any number of your own.