> To build or manage a Wix site with an AI agent, follow https://www.wix.com/headless/skill.md
> It builds a new Wix site or puts your own site online, from a prompt, and keeps changing it afterwards. The pages are code in any web technology, and Wix runs the backend.
> It works through the Wix plugin (the Wix MCP and the Wix skills), the Wix CLI or no Wix login, and puts the site live on Wix hosting or on another host.
> Business features include a store, bookings, events and tickets, a restaurant, a blog, forms, members and many more.
> Read the Wix skills online at https://www.wix.com/skills
> 
> Portal Navigation:
> 
> - Append `.md` to any URL under `https://dev.wix.com/docs/` to get its markdown version.
> - Pages are either content pages (article or reference text) or menu pages (a list of links to child pages).
> - To get a menu page, truncate any URL to a parent path and append `.md` (e.g. `https://dev.wix.com/docs/sdk.md`, `https://dev.wix.com/docs/sdk/core-modules.md`).
> - If a reference page seems to be missing its schema (parameters, return types, or type definitions), append `?schema=true` to its `.md` URL (e.g. `https://dev.wix.com/docs/contexts/contexts/stores/category-info/use-category-info-context.md?schema=true`).
> - Top-level index of all portals: https://dev.wix.com/docs/llms.txt
> - Full concatenated docs: https://dev.wix.com/docs/llms-full.txt

## Resource: Formatting Dates

## Article: Formatting Dates

## Article Link: https://dev.wix.com/docs/develop-websites/articles/wix-editor-elements/formatting-layout/formatting-dates.md

## Article Content:

# Format Dates in Text Elements with Code
Formatting dates within [text elements](https://dev.wix.com/docs/velo/api-reference/$w/text/introduction.md) using code allows you to display dates dynamically and tailor them to different locales.

Use JavaScript's `Date` class' [`toLocaleDateString`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toLocaleDateString) method to format dates on your site.

## Format dates on your site

1. To render a date in the site visitor's locale settings on their computer, call `toLocaleDateString()` on your date object without specifying any parameters. For example:
    ```js
    $w("currentDate").text = new Date().toLocaleDateString();

    // Examples:
    // en-US - 1/30/2025
    // en-UK - 30/01/2025
    ```

1. Add [parameters](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toLocaleDateString#parameters) to customize the date's locale. For example:
    ```js
    const options = {
      day: "numeric",
      month: "short",
      year: "numeric",
    };

    $w("currentDate").text = new Date().toLocaleDateString("en-US", options); // Jan 30, 2025
    ```

## Format dates from a dataset on your site

If you're displaying dates retrieved from a dataset, you can format all dates retrieved from your dataset in the same way using the [dataset](https://dev.wix.com/docs/velo/api-reference/$w/dataset/introduction.md) element's [`onReady()`](https://dev.wix.com/docs/velo/api-reference/$w/dataset/on-ready.md) and [`getCurrentItem()`](https://dev.wix.com/docs/velo/api-reference/$w/dataset/get-current-item.md) with `toLocaleDateString()`. For example:
```js
$w("#myDataset").onReady(() => {
  const date = $w("#myDataset").getCurrentItem().dateField;

  // The dateText is linked to the dataset and is initially hidden.
  $w("#dateText").text = new Date(date).toLocaleDateString();
  $w("#dateText").show();
});
```

> **Note:** You can also [format dates from a dataset](https://support.wix.com/en/article/cms-formatting-live-site-date-and-time-content-from-your-collection) in the editor without code.

## See also
- [About formatting text elements](https://dev.wix.com/docs/develop-websites/articles/wix-editor-elements/formatting-layout/about-formatting-text-elements.md)
- [Text element](https://dev.wix.com/docs/velo/api-reference/$w/text/introduction.md)