3
I have a value timestamp one-date, 1389135600
, how can I convert this value to a date of this kind 27/12/2014
.
3
I have a value timestamp one-date, 1389135600
, how can I convert this value to a date of this kind 27/12/2014
.
5
Assuming this number is a timestamp valid would only need to create a date based on it. As we should consider only the seconds, it is multiplied by 1000.
With the date in hand you can use it in the format you want. The data type can do this with methods suitable for some common formats, such as toLocaleDateString
.
The function meuLog
was used only to facilitate printing.
var date = new Date(1389135600*1000); // converte para data
console.log(date.toLocaleDateString("pt-BR")); //formata de acordo com o requisito
Browser other questions tagged javascript datetime timestamp
You are not signed in. Login or sign up in order to post.