--- title: "system.dataset.formatDates" description: "Returns a new dataset with Date columns as strings formatted according to the dateFormat specified." --- # system.dataset.formatDates > Returns a new dataset with Date columns as strings formatted according to the dateFormat specified. This function is used in **Python Scripting**. ## Description Returns a new [dataset](platform\scripting\python-scripting\variables-datatypes-and-objects\datasets.md) replacing date typed columns with string typed columns. The new columns will match the formatting specified by the dateFormat parameter. ## Client Permission Restrictions This scripting function has no [Client Permission](../../../ignition-modules/vision/vision-project-properties/vision-project-properties.md#vision-permissions-properties) restrictions. ## Syntax `system.dataset.formatDates( dataset, dateFormat, [locale] )` ### Parameters Type | Parameter | Description ------- | ------- | ------- Dataset / PyDataset | `dataset` | The starting dataset to format. String |`dateFormat` | A valid Java DateFormat string, representing how the date should be formatted. For example: "yyyy-MM-dd HH:mm:ss". Refer to [Data Type Formatting Reference](../../../appendix/reference-pages/data-type-formatting-reference/data-type-formatting-reference.md) for more information on the valid characters. Locale |`locale` | The Locale to use for formatting. The Locale parameter accepts any valid Java Locale object, which can be found [here](https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/Locale.html). The Java Locale class must be imported, and the Locale must be defined in all caps. See the second example below for an idea of how that works. If no locale is provided, the system’s locale will be used. [optional] ### Returns **Dataset** - A new dataset, containing the formatted dates. ### Scope Gateway, Vision Client, Perspective Session ## Code Examples ```python title="Code Snippet" # This example takes the dataset from a Vision Table component and formats the dates to look like Fri, Jan 22, 2018. # Reference the table's existing dataset data = event.source.parent.getComponent('Table').data # Apply formatting, and store the results in a new variable formattedData = system.dataset.formatDates(data, "EEE, MMM d, yyyy") # Write back to the table event.source.parent.getComponent('Table').data = formattedData ``` ```python title="Code Snippet" # This example formats the date similarly to the last example, but uses the Italian Locale, which causes the dates to be formatted with the Locale. from java.util import Locale data = event.source.parent.getComponent('Table').data locale = Locale.ITALY formattedDataFr = system.dataset.formatDates(data, "yyyy-MM-dd HH:mm:ss", locale) # Write back to the table event.source.parent.getComponent('Table').data = formattedDataFr ```