Answer the question
In order to leave comments, you need to log in
How to convert date string using js?
How to convert date string using js?
Line type: Oct 26 2015 08:30:50:730PM
Answer the question
In order to leave comments, you need to log in
You can use phpJS.
strtotime and date
date("Y-m-d", strtotime("Oct 26 2015 08:30:50:730PM"));
Я делаю так, стороне сервера дату конвертирую в unix_timestamp
unix_timestamp( post_date )*1000
в javascript :
var d = new Date(parseInt(response.post_date));
var months = ['01','02','03','04','05','06','07','08','09','10','11','12'];
$('').html(d.getFullYear() + "-" + months[d.getMonth()] + "-" + d.getDate() ).appendTo(tr);
ну и еще - d.getSeconds();
d.getMinutes();
d.getHours();
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question