Closed wojcikm closed 7 years ago
I'm blind. Found it in the examples link eventually.
formatter: { date: function (date, settings) { if (!date) return ''; var day = date.getDate(); var month = date.getMonth() + 1; var year = date.getFullYear(); return year + '-' + month + '-' + day; } }
Also with this method can be used for "YYYY/MM/DD" format:
private formatDate(date: Date): string { if (!date) return ''; let day = date.getDate() + '', month = (date.getMonth() + 1) + '', year = date.getFullYear(); if (day.length < 2) day = '0' + day; if (month.length < 2) month = '0' + month; return year + '/' + month + '/' + day; }
Hello everyone, I couldn't found any information there, also #31 does not work for me (it gives me back an divs element instead of a string). I want to get a date in format yyyy-mm-dd. Still believe there is a single-line solution for this.