# Dates and Locales

> Store dates as serials in the 1900 or 1904 date system, display them with format codes such as dd.mm.yyyy and set the format of dashboard date filters.

- **Product:** TX Sheet Control
- **Section:** Documentation
- **Kind:** Topic
- **Path:** TX Sheet Control > Spreadsheet Documents > Dates and Locales
- **674 words**
- **Web URL:** https://docs.textcontrol.com/tx-sheet-control/spreadsheets/dates/
- **LLMs URL:** https://docs.textcontrol.com/tx-sheet-control/spreadsheets/dates/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/tx-sheet-control/spreadsheets/dates/llms-full.txt

---

Four things decide how a date behaves in a workbook: the stored value, the workbook's date system, the number-format code and the locale. Keep these responsibilities explicit when you import, calculate, filter or export dates. What follows covers date values and date systems, their display in cells and the date filters of dashboards.

### How Dates Are Stored

Excel-compatible date values can be numeric serials. The workbook uses the 1900 or the 1904 date system, so do not reuse a serial in a different system without conversion. Time-of-day values are fractional days. Date formulas calculate values, while cell formatting determines their presentation.

ISO date text can be appropriate for application data. Arbitrary localized text is not automatically equivalent to a typed date. Prefer a deliberate conversion at the application boundary.

### Display Dates

Apply an Excel-style format such as `dd.mm.yyyy` for a German calendar display, or another explicit supported code. The number and date locale is distinct from the interface language of the editor, described in [Appearance and Localization](https://docs.textcontrol.com/tx-sheet-control/spreadsheet-editor/appearance/llms-full.txt). When reproducibility matters, supply the time zone and the locale for PDF output on the backend.

### Set the Format of a Date Filter

A date filter widget on a dashboard inherits the date format and the locale of its spreadsheet source field. Override the widget's `dateFilter.format` if needed. Range pickers support inclusive start and end periods. Searchable date choices and the day, month or year granularity live directly in the widget.

The following code changes the date filter widget `period` to a range picker with day granularity and German dotted dates. `dashboard` is a [Dashboard](https://docs.textcontrol.com/tx-sheet-control/reference/javascript-api/browser/dashboard/llms-full.txt) of the workbook:

```javascript
dashboard.updateWidget('period', {
    dateFilter: { mode: 'range', granularity: 'day', format: 'dd.mm.yyyy' }
});
```

The code works as follows:

- [Dashboard.updateWidget](https://docs.textcontrol.com/tx-sheet-control/reference/javascript-api/browser/dashboard/updatewidget-method/llms-full.txt) updates the widget with the ID `period` without changing its identity. Settings the patch does not name are retained.
- [dateFilter](https://docs.textcontrol.com/tx-sheet-control/reference/typescript-api/browser/dashboardwidget/datefilter-property/llms-full.txt) sets the initial controls of the date filter: `mode: 'range'` for a range picker, `granularity: 'day'` for days and `format: 'dd.mm.yyyy'` to override the format inherited from the source field.

The analytics date comparisons support the documented serial, ISO and dotted calendar inputs. Saved filters retain their own period and granularity. A date-format override changes the presentation and parsing for that widget; it does not rewrite the source worksheet.

Test end-of-month boundaries, time portions, blanks and imported formatting.

### Next Steps

- [Filters and Drill-Down](https://docs.textcontrol.com/tx-sheet-control/dashboards/filters/llms-full.txt): filter a dashboard by dates and other fields, and drill into its data.
- [Formatting and Number Display](https://docs.textcontrol.com/tx-sheet-control/spreadsheets/formatting/llms-full.txt): apply number and date formats to cells.

---

## Nearby

- **Previous:** [Named Ranges and External References](https://docs.textcontrol.com/tx-sheet-control/spreadsheets/named-ranges/llms-full.txt)
- **Next:** [Tables](https://docs.textcontrol.com/tx-sheet-control/spreadsheets/tables/llms-full.txt)
