# CDate Function

**YouTube:** [How to Use the CDate Function in Report Custom Columns?](https://www.youtube.com/watch?v=iynKifN5EVg)

## How to Use the CDate Function in Report Custom Columns?

In this tutorial, we'll demonstrate how to convert values into proper date format using the `CDate` function within report grids. You'll learn how to configure the script editor, create a custom expression, and display the value as a valid date in your report.

***

### Accessing the Expression Designer:

* Navigate to the **Reporting** section.
* Open the **Sales Register Detailed Report** or any **"Report".**
* Go to **Setup Column Attributes**.
* Here, you'll see a list of available columns that can be used to build expressions.
* Click on **"Add/Edit Expression Columns"** where you can write your expression using predefined functions.

<figure><img src="/files/QqZlgPb7nJy0O1lsvxB5" alt=""><figcaption></figcaption></figure>

* Before adding the expression to the report, go to **Other Settings**.
* Ensure the **Script Editor** is set to **VBScript**.

<figure><img src="/files/US8rZzar6siLdptkuOMX" alt=""><figcaption></figcaption></figure>

* Click **Save**.
  * *Note: VBScript is the default for new configurations but always verify this setting.*

### Writing Your First Expression

* Every expression must start with the script header: **'#@LSCRIPT**

<figure><img src="/files/K37bBe9AvTCKOiLXaocU" alt=""><figcaption></figcaption></figure>

* Click the (+) Plus icon to create a new expression.
* Fill in the required fields:&#x20;
  * **Expression Name** – A unique name for your expression.
  * **Expression Type** – Choose either **Text** or **Numeric** depending on the expected output.

<figure><img src="/files/myhie33Ja6ZPEfbVOqpJ" alt=""><figcaption></figcaption></figure>

* Double-click the new expression name to insert it into the script editor.
* Define the expression using the syntax:
  * **Expression Name** = CDATE(BILL\_DATE).

<figure><img src="/files/elx1nMytZQiQTETsjdkN" alt=""><figcaption></figcaption></figure>

* Click **Save**.
* Scroll down and **check the box** to enable the column in the report.

<figure><img src="/files/fctRI90vXi6wxV9rcLqy" alt=""><figcaption></figcaption></figure>

* Save and proceed to check the effect.
* **Refresh the report** to view the final result.

<figure><img src="/files/OnADEUeeBjofCoiTZ2oL" alt=""><figcaption></figcaption></figure>

***

### Output:

* The column now displays the **value in proper date format**.
* This is especially useful when:
  * Performing **date-based calculations**
  * Applying **filters or comparisons**
  * Formatting for **display purposes**

***


---

# Agent Instructions: Querying This Documentation

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

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://kb.logicerp.com/logic-erp-learning-hub-tutorials-and-best-practices/defining-custom-columns-in-reports-and-grids-with-expressions/cdate-function.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
