> For the complete documentation index, see [llms.txt](https://docs.devolutions.net/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.devolutions.net/powershell-universal/apps/components/data-display/date-and-time.md).

# Date and Time

Format dates and times in PowerShell Universal apps with New-UDDateTime, using DayJS formatting templates and locale settings for browser rendering.

The `New-UDDateTime` component is used for formatting dates and times within the client's browser. By using the client's browser, you can format the time based on the local time zone and locale settings for the user.

{% hint style="warning" %}
The output of `New-UDDateTime` cannot be used with components like `New-UDHtml`, `New-UDMarkdown` or `Show-UDToast`. The object returned by `New-UDDateTime` needs to run JavaScript within the browser and is not an actual DateTime object.
{% endhint %}

The date and time component uses DayJS. For a full list of custom formatting options, visit the [DayJS documentation](https://day.js.org/docs/en/display/format).

## Basic Formatting

By default, the date and time will be formatted using the `LLL` localized formatting template.

```powershell
New-UDDateTime -InputObject (Get-Date)
```

Resulting output: August 16, 2018 8:02 PM

## Custom Formatting

You can specify custom formatting strings using the [DayJS formatting template](https://day.js.org/docs/en/display/format).

```powershell
New-UDDateTime -InputObject (Get-Date) -Format 'DD/MM/YYYY'
```

Resulting output: 25/01/2019

## Locale

You can specify the locale to display the date and time in.

```powershell
New-UDDateTime -InputObject (Get-Date) -Locale 'es'
```

Resulting output: 13 de septiembre de 2022 7:30

## API

[**New-UDDateTime**](/powershell-universal/powershell-commands/new-uddatetime.md)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.devolutions.net/powershell-universal/apps/components/data-display/date-and-time.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
