0

How can I format a "Java-Date" in seconds since 1970 to an dd.mm.yyyy HH:MM:SS in php. I have this date as an variable in php:

$date = "1362065364128";

0

4 Answers 4

2
$date = "1362065364128";
$phpDate = date('d.m.y H:i:s', $date/1000);
Sign up to request clarification or add additional context in comments.

Comments

2

It's called a unix timestamp, and you can pass it as the second argument to the date function in php-

Comments

1

You can use the PHP method date, note that the three last numbers are milliseconds here, so you need to disregard them first.

$date = "1362065364128";
$formatted = date('Y-m-d H:i:s', intval($date) / 1000);

Comments

0

Use the PHP date function, documentation here

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.