W
W
wolf-98302016-08-02 19:11:21
PHP
wolf-9830, 2016-08-02 19:11:21

Are there analogues of the to_char function in PostgreSQL?

Is there an analogue of the following function in php?
TO_CHAR(1, '0000') // here the result will be 0001

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
Melkij, 2016-08-02
@melkij

lpad?
It's not very clear what exactly the function does.
In any case, you can write your own implementation.

V
Vladimir, 2016-08-03
@rostel

sprintf
echo sprintf("%'.04d", 1);

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question