Convert timestamp to date in MySQL query

I want to convert a timestamp in MySQL to a date. I would like to format the user.registration field into the text file as a yyyy-mm-dd. Here is my SQL: $sql = requestSQL(“SELECT user.email, info.name, FROM_UNIXTIME(user.registration), info.news FROM user, info WHERE user.id = info.id “, “export members”); I also tried the date conversion with: DATE_FORMAT(user.registration, … Read more

How do I format a date as ISO 8601 in moment.js?

This docs mention moment.ISO_8601 as a formatting option (from 2.7.0 – http://momentjs.com/docs/#/parsing/special-formats/), but neither of these work (even 2.7.0): var date = moment(); date.format(moment.ISO_8601); // error moment.format(date, moment.ISO_8601); // error (http://jsfiddle.net/b3d6uy05/1/) How can I get an ISO 8601 from moment.js? 9 Answers 9

How to format time since xxx e.g. “4 minutes ago” similar to Stack Exchange sites

The question is how to format a JavaScript Date as a string stating the time elapsed similar to the way you see times displayed on Stack Overflow. e.g. 1 minute ago 1 hour ago 1 day ago 1 month ago 1 year ago 31 Answers 31 function timeSince(date) { var seconds = Math.floor((new Date() – … Read more