Every line of 'moment format yyyy-mm-dd' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your JavaScript code is secure.
8 static formatDateYYYYMMDD(date) { 9 return DateFormatter.format(date, "yyyy-MM-dd"); 10 }
45 function dateformat () { 46 return 'yyyy-MM-dd'; 47 }
102 _formatDate (date) { 103 // Only when the granularity desired is hour we set the offset with Moment.format() 104 return (this.period.unit === 'hour') ? date.format() : date.format(MACHINE_DATE_FORMAT) 105 }
14 function formatDate (date) { 15 if (!formatDateTime) { 16 return null 17 } 18 19 return _toMoment(date).format('L') 20 }
13 function dateToDateTime(d) { 14 if (d) { 15 var date = moment(d); 16 // return null if not is valid 17 if (!date.isValid()) return null; 18 // return data in datetime format 19 return date.format('YYYY-MM-DD HH:mm:ss'); 20 } else { 21 return null; 22 } 23 }
618 formatDate(mom, format = this.config.format) { 619 return mom.format(format) 620 }
486 formatDate(d) { 487 const calendar = this; 488 const date = new Date(d); 489 const year = date.getFullYear(); 490 const month = date.getMonth(); 491 const month1 = month + 1; 492 const day = date.getDate(); 493 const weekDay = date.getDay(); 494 const { monthNames, monthNamesShort, dayNames, dayNamesShort } = calendar; 495 const { dateFormat, locale } = calendar.params; 496 if (typeof dateFormat === 'string') { 497 return dateFormat 498 .replace(/yyyy/g, year) 499 .replace(/yy/g, String(year).substring(2)) 500 .replace(/mm/g, month1 < 10 ? `0${month1}` : month1) 501 .replace(/m(\W+)/g, `${month1}$1`) 502 .replace(/MM/g, monthNames[month]) 503 .replace(/M(\W+)/g, `${monthNamesShort[month]}$1`) 504 .replace(/dd/g, day < 10 ? `0${day}` : day) 505 .replace(/d(\W+)/g, `${day}$1`) 506 .replace(/DD/g, dayNames[weekDay]) 507 .replace(/D(\W+)/g, `${dayNamesShort[weekDay]}$1`); 508 } 509 if (typeof dateFormat === 'function') { 510 return dateFormat(date); 511 } 512 // Intl Object 513 const formatter = new Intl.DateTimeFormat(locale, dateFormat); 514 return formatter.format(date); 515 }
180 export function dateFormat(timestamp, format = 'yyyy-MM-dd hh:mm:ss') { 181 timestamp = timestamp.length === 13 ? timestamp : timestamp * 1000 182 let date = new Date(timestamp) 183 let args = { 184 'M+': date.getMonth() + 1, 185 'd+': date.getDate(), 186 'h+': date.getHours(), 187 'm+': date.getMinutes(), 188 's+': date.getSeconds() 189 } 190 if (/(y+)/.test(format)) { 191 format = format.replace( 192 RegExp.$1, 193 (date.getFullYear() + '').substr(4 - RegExp.$1.length) 194 ) 195 } 196 for (var i in args) { 197 let n = args[i] 198 if (new RegExp('(' + i + ')').test(format)) { 199 format = format.replace( 200 RegExp.$1, 201 RegExp.$1.length === 1 ? n : ('00' + n).substr(('' + n).length) 202 ) 203 } 204 } 205 return format 206 }
40 function formatDate(date) { 41 var formatString = atom.config.get('git-blame.dateFormatString'); 42 return date.format(formatString); 43 }
10 export function formatDate(date: Date): string { 11 return london(date).format('D MMMM YYYY'); 12 }