---
category: [Administration & Integrations, Platform and Product Extensions, Platform and Product Extensions/Integration, Administration & Integrations/Custom Integrations & Apps, Platform and Product Extensions/Workday Extend]
keyword: [Extend, PMD Scripting, Scripts]
nav: wcp_docs
parent_url: /wcp_docs/
title: format (dateFormat)
layout: subsection
---

## <a id="section_m3p_myb_5db"></a>Description

Returns a string representation of the given date in the given format.

## <a id="section_cyq_j1m_zsb"></a>Return Type

`String`

## <a id="section_instanceMethodSyntax"></a>Instance Method Syntax

```
thisDate.format(dateFormat)
```

<table><thead><tr><th>Parameter</th><th>Description</th></tr></thead><tbody><tr><td>dateFormat</td><td>A date format string. For valid date formats, see the Java documentation for <code>java.text.SimpleDateFormat</code>.</td></tr></tbody></table><br/>

<b>Example</b>

`dateWidget.value.format('MM/dd/yyyy HH:mm:ss')` - Returns the date and 24-hour time format (Example: 03/01/2022 15:30:00).

`dateWidget.value.format('E')` - Returns the name of the day (Example: Fri for Friday).

`dateWidget.value.format('u')` - Returns the number of the day (Example: 5 for Friday).

## <a id="section_dz5_pwg_5db"></a>Namespace Function Syntax

```
date:format(date, dateFormat)
```

<table><thead><tr><th>Parameter</th><th>Description</th></tr></thead><tbody><tr><td>date</td><td>A Date object, typically the value of a date or time tag.</td></tr><tr><td>dateFormat</td><td>A date format string. For valid date formats, see the Java documentation for <code>java.text.SimpleDateFormat</code>.</td></tr></tbody></table><br/>

<b>Example</b>

`date:format({Date tag with year = 2016, month = October, day =31}, 'dd/MM/yyyy')`

Returns `'31/10/2016'`

### Related Information

[formatDateWithTimeZones (date, inputTimeZone, inputDateTimeFormat, outputTimeZone, outputDateTimeFormat)](/wcp_docs/bgs1527623684746.html)

[formatWithTimeZone (dateFormat, timeZone)](/wcp_docs/msn1526018546174.html)

