O
O
olezhenka2017-04-28 11:10:09
PHP
olezhenka, 2017-04-28 11:10:09

How to decode the date in this format 1493316022?

I give a VKontakte API request using the wall.get method - https://vk.com/dev/wall.get and get data with a date in this format. How to decrypt it?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Andrey Burov, 2017-04-28
@olezhenka

This is the PHP timestamp :

echo date('r', 1493316022);
// Thu, 27 Apr 2017 18:00:22 +0000

JavaScript:
date = new Date(1493316022 * 1000);
console.log(date.toString());
//Thu Apr 27 2017 21:00:22 GMT+0300 (MSK)

A
Apachaiblow, 2017-04-28
@Apachaiblow

To get the date from it in js
new Date(1493316022 * 1000)
The time stamp is specified in seconds and we need it in milliseconds

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question