Every line of 'angularjs date format' 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.
79 private formatToDateString(date: Date, format: string): string { 80 return this.datePipe.transform(date, format); 81 }
114 format(date: string): string { 115 if (!date) { 116 return ''; 117 } 118 119 date = date.toString().replace(/[^0-9]+/g, ''); 120 if (date.length > this.symbolsPositions[0]) { 121 date = date.substring(0, 2) + '/' + date.substring(2); 122 } 123 if (date.length > this.symbolsPositions[1]) { 124 date = date.substring(0, 5) + '/' + date.substring(5, 9); 125 } 126 return date.substring(0, this.maxlength); 127 }
25 currentDateFormat(date, format: string = 'yyyy-mm-dd HH:MM:ss'): any { 26 const pad = (n: number): string => (n < 10 ? `0${n}` : n.toString()); 27 return format 28 .replace('yyyy', date.getFullYear()) 29 .replace('mm', pad(date.getMonth() + 1)) 30 .replace('dd', pad(date.getDate())) 31 .replace('HH', pad(date.getHours())) 32 .replace('MM', pad(date.getMinutes())) 33 .replace('ss', pad(date.getSeconds())); 34 }
33 getNgbDateFormat(date): NgbDate { 34 const newDate = new NgbDate(date.getFullYear(), date.getMonth() + 1, date.getDate()); 35 return newDate; 36 }
98 function formatLocalDate() { 99 var now = new Date(), 100 tzo = -now.getTimezoneOffset(), 101 dif = tzo >= 0 ? '+' : '-', 102 pad = function(num) { 103 var norm = Math.abs(Math.floor(num)); 104 return (norm < 10 ? '0' : '') + norm; 105 }; 106 return now.getFullYear() + '-' + pad(now.getMonth() + 1) + '-' + pad(now.getDate()) + 'T' + pad(now.getHours()) + ':' + pad(now.getMinutes()) + ':' + pad(now.getSeconds()) 107 }
170 dateToString(date: Date | Moment | string): string { 171 if (date instanceof Date) { 172 return date.toISOString(); 173 } 174 return moment(date).toISOString(); 175 }
183 dateFilter(date: Date, format: string): string { 184 return this.dateFormatter.format(date, format, this.locale); 185 }
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 }
8 static formatDateYYYYMMDD(date) { 9 return DateFormatter.format(date, "yyyy-MM-dd"); 10 }
30 $scope.getDayDateFormatted = function getDayDateFormatted(date) { 31 return $filter('date')(date, 'dd'); 32 };