> ## Documentation Index
> Fetch the complete documentation index at: https://doc.lucidworks.com/llms.txt
> Use this file to discover all available pages before exploring further.

# dateFormat

export const LwTemplate = ({title = "Key questions to get you started", icon = "sparkles", cta = "Powered by Agent Studio", linkHref = "https://lucidworks.com/demo/?utm_source=docs&utm_medium=referral&utm_campaign=docs_cta_ai"}) => {
  const [isLoaded, setIsLoaded] = useState(false);
  useEffect(() => {
    const timer = setTimeout(() => {
      setIsLoaded(true);
    }, 500);
    return () => clearTimeout(timer);
  }, []);
  return <div className="lw-template-container">
      <Card title={title} icon={icon}>
        {isLoaded && <span dangerouslySetInnerHTML={{
    __html: `<lw-template id="a029c1a9-28be-427e-b0e1-5d918920246a"></lw-template
            >`
  }} />}
        <Link href={linkHref} className="agent-studio-link text-left text-gray-600 gap-2 dark:text-gray-400 text-sm font-medium flex flex-row items-center hover:text-primary dark:hover:text-primary-light group-hover:text-primary group-hover:dark:text-primary-light">Powered by Lucidworks Agent Studio</Link>
      </Card>
    </div>;
};

[localhost link]: http://localhost:3000/docs/4/app-studio/reference/filters/lightning.filter.dateFormat

[mintlify link]: https://doc.lucidworks.com/docs/4/app-studio/reference/filters/lightning.filter.dateFormat

[old doc.lw link]: https://doc.lucidworks.com/app-studio/4.2/1027

#

<LwTemplate />

## Description

Formats `date` to a string based on the requested `format`.

`format` string can be composed of the following elements:

* `'yyyy'`: 4 digit representation of year (e.g. AD 1 => 0001, AD 2010 => 2010)
* `'yy'`: 2 digit representation of year, padded (00-99). (e.g. AD 2001 => 01, AD 2010 => 10)
* `'y'`: 1 digit representation of year, e.g. (AD 1 => 1, AD 199 => 199)
* `'MMMM'`: Month in year (January-December)
* `'MMM'`: Month in year (Jan-Dec)
* `'MM'`: Month in year, padded (01-12)
* `'M'`: Month in year (1-12)
* `'LLLL'`: Stand-alone month in year (January-December)
* `'dd'`: Day in month, padded (01-31)
* `'d'`: Day in month (1-31)
* `'EEEE'`: Day in Week,(Sunday-Saturday)
* `'EEE'`: Day in Week, (Sun-Sat)
* `'HH'`: Hour in day, padded (00-23)
* `'H'`: Hour in day (0-23)
* `'hh'`: Hour in AM/PM, padded (01-12)
* `'h'`: Hour in AM/PM, (1-12)
* `'mm'`: Minute in hour, padded (00-59)
* `'m'`: Minute in hour (0-59)
* `'ss'`: Second in minute, padded (00-59)
* `'s'`: Second in minute (0-59)
* `'sss'`: Millisecond in second, padded (000-999)
* `'a'`: AM/PM marker
* `'Z'`: 4 digit (+sign) representation of the timezone offset (-1200-+1200)
* `'ww'`: Week of year, padded (00-53). Week 01 is the week with the first Thursday of the year
* `'w'`: Week of year (0-53). Week 1 is the week with the first Thursday of the year
* `'G'`, `'GG'`, `'GGG'`: The abbreviated form of the era string (e.g. 'AD')
* `'GGGG'`: The long form of the era string (e.g. 'Anno Domini')
* `'medium'`: equivalent to `'MMM d, y h:mm:ss a'`
* `'short'`: equivalent to `'M/d/yy h:mm a'`
* `'fullDate'`: equivalent to `'EEEE, MMMM d, y'`
* `'longDate'`: equivalent to `'MMMM d, y'`
* `'mediumDate'`: equivalent to `'MMM d, y'`
* `'shortDate'`: equivalent to `'M/d/yy'`
* `'mediumTime'`: equivalent to `'h:mm:ss a'`
* `'shortTime'`: equivalent to `'h:mm a'`
* `'relative'`: displays the time since/until the date

`format` string can contain literal values. These need to be escaped by surrounding with single quotes (e.g.
`"h 'in the morning'"`). In order to output a single quote, escape it - i.e., two single quotes in a sequence
(e.g. `"h 'o''clock'"`).

## Usage

### In HTML Template Binding

`{{ dateFormat_expression | dateFormat:format[:timezone] }}`

### In JavaScript

`$filter('dateFormat')(date, format[, timezone])`

#### Parameters

| Param                 | Type             | Details                                                                                                                                                                                                                                                                                       |
| --------------------- | ---------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| date                  | Datenumberstring | The date value to format.                                                                                                                                                                                                                                                                     |
| format                | string           | The format to render the date value in.                                                                                                                                                                                                                                                       |
| timezone *(optional)* | string           | Timezone to be used for formatting. It understands UTC/GMT and the continental US time zone abbreviations, but for general use, use a time zone offset, for example, '+0430' (4 hours, 30 minutes east of the Greenwich meridian) If not specified, the timezone of the browser will be used. |
