---
title: "system.mes.spc.analysis.formatDate(date)"
id: "system-mes-spc-analysis-formatdate-date"
project: "MES User Manual"
url: "https://docs.sepasoft.com/articles/user-manual/system-mes-spc-analysis-formatdate-date"
updated: 2026-07-31T14:54:46Z
---

# system\.mes\.spc\.analysis\.formatDate\(date\)

**Sepasoft MES Module Suite**

### system.mes.spc.analysis.formatDate(date)

Returns a string for the specified date and is formatted correctly for a filter expression.

| ![Warning](/resources/Storage/user-manual/user-manual/Warning.png) | **Scripting Function modifications in**<br><br>MES 3.79.3 RC 5 and later<br>MES 3.81.4 RC 5 and later |
| --- | --- |

Syntax

**system.mes.spc.analysis.formatDate(date)**

* Parameters

Date date - A Date object to format.

* Returns

String - A SPC settings formatted date string.

* Scope

All

Code Example

```python
locationPath = 'Enterprise\El Dorado Hills\Packaging Area\Packaging Line 1\Inspection Station 1'

startDate = system.mes.spc.analysis.formatDate(system.date.addHours(system.date.now(), -1))
endDate = system.mes.spc.analysis.formatDate(system.date.now())

definitionName = 'Case Inspection'
attribute = 'Fill Level'

controlLimits = 'CpPpUSL,CpPpLSL,PpTarget'
signals = ''
dataFormatName = 'Process Capability and Performance'
filters=''

spcsettings = system.mes.spc.analysis.createSettings(definitionName, attribute, filters, controlLimits, signals, dataFormatName)

filter = spcsettings.encodeList(['FromDate='+startDate,'ToDate='+endDate,'Location='+locationPath])
spcsettings.setFilters(filter)

results = system.mes.spc.analysis.getSPCResults(spcsettings)

ds = results.getTableResults()
print ds
print ds.getColumnNames()

for row in range(ds.getRowCount()):
	for col in range(ds.getColumnCount()):
		print ds.getColumnName(col),ds.getValueAt(row,col)


```


**Sepasoft MES Module Suite**