Every line of 'angular format date' 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 }
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 }
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 }
30 $scope.getDayDateFormatted = function getDayDateFormatted(date) { 31 return $filter('date')(date, 'dd'); 32 };
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 }
8 static formatDateYYYYMMDD(date) { 9 return DateFormatter.format(date, "yyyy-MM-dd"); 10 }
23 function toFormattedDate(startTimeInMillis) { 24 if (typeof(startTimeInMillis) === 'undefined') { 25 startTimeInMillis = moment().valueOf().toString(); 26 } 27 return moment(parseInt(startTimeInMillis, 10)).format(momentDateFormat); 28 }
105 public formattedDate(date:string) { 106 var d = this.parseDate(date); 107 return d.format(this.getDateFormat()); 108 }