# WeekDayName() Function

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

## How to Use the WeekDayName () Function in Report Custom Columns?

In this tutorial, we'll walk you through designing an expression using the `WeekdayName` function, which returns the **name of the day** (e.g., Monday, Tuesday) from a date field such as *Bill Date*.

***

### 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="https://4031188996-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FXMVkjt8zqHBQX1c9QvFS%2Fuploads%2FBiD7B0nHi6iarn4CKfDv%2FBill%20Setup%20column%20attribute.png?alt=media&#x26;token=a582faef-5c69-4eb5-ac56-48057aaab80b" 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="https://4031188996-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FXMVkjt8zqHBQX1c9QvFS%2Fuploads%2FPgRPBYdOmbcuIH0PZ7sI%2FOther%20Setting%20-%20VB%20Print.png?alt=media&#x26;token=60981fe7-c38c-4bf4-a8d9-40a3289ddbd7" 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="https://4031188996-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FXMVkjt8zqHBQX1c9QvFS%2Fuploads%2F6sCEhRlGWfBL2O3Tg0XY%2FBill%20Setup%20column%20attribute%20Default%20Script.png?alt=media&#x26;token=af5f02ec-c5a6-41e5-bf23-16e2265b02e7" 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="https://4031188996-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FXMVkjt8zqHBQX1c9QvFS%2Fuploads%2FMjh98Hgr08R6lUj86xev%2FAdd%20New%20Report.png?alt=media&#x26;token=3e120499-a8fd-496b-af37-898f2f04cb7c" alt=""><figcaption></figcaption></figure>

***

### Creating a Simple WeekDayName() Expression

* Double-click your newly created expression to insert it into the script editor.
* Define the expression using the syntax:
  * Expression Name = WeekDayName(CDATE(BILL\_DATE))
    * `WeekdayName(...)` converts that date into the **day name** like "Wednesday".
    * `CDate(BILL_DATE)` ensures the string is interpreted as a proper date.

<figure><img src="https://4031188996-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FXMVkjt8zqHBQX1c9QvFS%2Fuploads%2FhOBMZgqxf1ODgqhPJHj2%2FExpression%20Formula.png?alt=media&#x26;token=97df148c-f1a2-40b0-b28c-a6c151cdf5b5" alt=""><figcaption></figcaption></figure>

* Save the expression once defined.
* Scroll down and **check the box** beside the expression name to enable it.

<figure><img src="https://4031188996-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FXMVkjt8zqHBQX1c9QvFS%2Fuploads%2FhtsN8Udcbx9YsYpZMxmj%2FSetup%20Column%20attribute.png?alt=media&#x26;token=04fb96ed-9a7e-494e-a5b9-3d09f0a050a6" alt=""><figcaption></figcaption></figure>

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

<figure><img src="https://4031188996-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FXMVkjt8zqHBQX1c9QvFS%2Fuploads%2FOPyK5V5QmsiuPTTAxFeq%2FImp_Rep.png?alt=media&#x26;token=b36c9ae1-40d1-4f92-bbaa-a29b7daf8045" alt=""><figcaption></figcaption></figure>

***

### Result:

The new column will now display the **name of the day** for each bill date.\
For example, if the *Bill Date* is `2025-06-09`, the column will display:

> **Monday**
