# Show current date

{% hint style="info" %}
You can use `dotnet watch` and observe the result of code changes instantly on the browser!
{% endhint %}

## Showing various variations of displaying date&#x20;

If you experience trouble with Visual Studio extension crashing, see [trouble shooting](https://raviram.gitbook.io/mvc-module-1/others/razor-practice/broken-reference).

#### using expression

```cshtml
@page
<p>Today's date is @DateTime.Now.Date</p>
```

#### using code block with expression

```cshtml
@page

@{
    var today = DateTime.Now.Date.ToShortDateString();
}
<p>Today's date is @today</p>
```

#### Using function directive

```cshtml
@page

@{
    ShowDateBold();
}

@functions {
    private void ShowDateBold()
    {
        <strong>@DateTime.Now.ToShortDateString()</strong>
    }
}
```
