VOOZH about

URL: https://www.geeksforgeeks.org/angular-js/angular-10-datepipe-api/

⇱ Angular 10 DatePipe API - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

Angular 10 DatePipe API

Last Updated : 4 Aug, 2021

In this article, we are going to see what is DatePipe in Angular 10 and how to use it.

DatePipe is used to format a date value according to locale rules.

Syntax:

{{ value | date }}

Approach: 

  • Create the angular app that to be used.
  • There is no need for any import for the DatePipe to be used.
  • In app.component.ts define the variable that takes date value.
  • In app.component.html use the above syntax to make date element.
  • serve the angular app using ng serve to see the output.
 

Parameters:

  • format: It takes a string value.
  • timezone: It takes a string value.
  • locale: It takes a string value.

Example 1:

Output:

👁 Image

Example 2:

Output:

👁 Image
Comment
Article Tags:

Explore