D
D
dev2expert2015-08-06 10:34:33
PHP
dev2expert, 2015-08-06 10:34:33

What is the correct way to convert timestamp to string?

This is most likely a very noob question, but I can't find what's wrong.
The docs say that the date function accepts a UNIX timestamp as an integer:

The optional timestamp parameter is an integer Unix timestamp that defaults to the current local time if a timestamp is not given.

Given code:
echo date('Y-m-d h:i:s', 1438369615);
echo date('Y-m-d h:i:s', 1438326415);

returns:
> 2015-07-31 03:06:55
> 2015-07-31 03:06:55

Why are the values ​​the same for different labels? What am I doing wrong?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Mikhail Osher, 2015-08-06
@dev2expert

H, not h.
H - 24format
h - 12 format, still need to deliver ap/pm (a/A)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question