Topics

Formatting date, time and currency

ImpressPages has automatic date, time and currency formatting functions. Automatic formatting makes easier to adopt your website data to local country date, time and currency standards.

Each formatting function needs to be provided with usage context as a second function argument. There are two usage contexts for formatting functions available: Ip-admin for administration pages and Ip for regular webpages.

Format date

<?php echo ipFormatDate(time(), 'Ip'); ?>

Format time

<?php echo ipFormatTime(time(), 'Ip'); ?>

Format date-time

<?php echo ipFormatDateTime(time(), 'Ip'); ?>

Format price

<?php echo ipFormatPrice(1050, 'EUR', 'Ip'); ?>

The price should be specified in cents (real price multiplied by 100). The example above outputs 10.50 EUR.

Custom format

You can catch ipFormatPrice, ipFormatPrice, ipFormatDate, ipFormatTime, ipFormatDateTime jobs and override default system behaviour. 

See also

comments powered by Disqus