Yerel ayar dizesini bağımsız değişken olarak DatePipe öğesine iletmeniz gerekir.
var ddMMyyyy = this.datePipe.transform(new Date(),"dd-MM-yyyy");
Önceden tanımlanmış format seçenekleri:
1. 'short': equivalent to 'M/d/yy, h:mm a' (6/15/15, 9:03 AM).
2. 'medium': equivalent to 'MMM d, y, h:mm:ss a' (Jun 15, 2015, 9:03:01 AM).
3. 'long': equivalent to 'MMMM d, y, h:mm:ss a z' (June 15, 2015 at 9:03:01 AM GMT+1).
4. 'full': equivalent to 'EEEE, MMMM d, y, h:mm:ss a zzzz' (Monday, June 15, 2015 at 9:03:01 AM GMT+01:00).
5. 'shortDate': equivalent to 'M/d/yy' (6/15/15).
6. 'mediumDate': equivalent to 'MMM d, y' (Jun 15, 2015).
7. 'longDate': equivalent to 'MMMM d, y' (June 15, 2015).
8. 'fullDate': equivalent to 'EEEE, MMMM d, y' (Monday, June 15, 2015).
9. 'shortTime': equivalent to 'h:mm a' (9:03 AM).
10. 'mediumTime': equivalent to 'h:mm:ss a' (9:03:01 AM).
11. 'longTime': equivalent to 'h:mm:ss a z' (9:03:01 AM GMT+1).
12. 'fullTime': equivalent to 'h:mm:ss a zzzz' (9:03:01 AM GMT+01:00).
app.component.module.ts içine datepipe ekle
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import {DatePipe} from '@angular/common';
@NgModule({
declarations: [
AppComponent
],
imports: [
BrowserModule
],
providers: [
DatePipe
],
bootstrap: [AppComponent]
})
export class AppModule { }
date
Boru halen bazı sorunlar vardır.