date (filter in module ng )

Description

Formats date to a string based on the requested format.

format string can be composed of the following elements:

format string can also be one of the following predefined localizable formats:

format string can contain literal values. These need to be quoted with single quotes (e.g. "h 'in the morning'"). In order to output single quote, use two single quotes in a sequence (e.g. "h o''clock").

Usage

In HTML Template Binding

{{ date_expression | date[:format] }}

In JavaScript

$filter('date')(date[, format])

Parameters

Returns

{string}

Formatted string or the input if input is not recognized as date/millis.

Example

Demo Source Code





Demo Source Code