---
title: "NEXT_DAY Vs DAYNAME Top SQL Examples"
description: "DATE calculation in SQL is tricky. Sometimes you need to find Day name, Day of the week, and Next Day Date. These example SQL queries useful for you."
url: https://srinimf.com/2020/07/12/next_day-vs-dayname-top-sql-examples/
date: 2020-07-12
modified: 2026-10-10
author: "Srini"
image: https://i0.wp.com/srinimf.com/wp-content/uploads/2020/07/sql-next_day-vs-dayname.jpg?fit=1200%2C700&ssl=1
categories: ["SQL"]
tags: ["DB2 SQL DAYNAME Example", "DB2 SQL NEXT_DAY Example"]
type: post
lang: en
---

# NEXT_DAY Vs DAYNAME Top SQL Examples

The **NEXT_DAY** function extracts DATE per the DAY you supplied in the SQL Query. The **DAYNAME** function gives you the name of the DAY. Below are the best DB2 examples.

---

Type your email…

Subscribe

Subscribe to receive latest posts.

- Next_Day Function needs two parameters.
- [DATE and](https://srinimf.com/2014/05/11/db2-date-and-timestamp-timezone/) DAY name.
- It gives DATE of the coming DAY (that you supplied in input).

Related[DB2 Date, Time Examples for Advanced Learners](https://srinimf.com/2017/01/03/the-best-db2-datetime-examples-for-advanced-learners/)

## SQL Query Example NEXT_DAY.

```
SELECT ship_date, NEXT_DAY(ship_date, 'SAT') 
AS next_saturday,
   NEXT_DAY(ship_date, 'SAT') - ship_date AS num_days 
FROM orders;
```

Related[How to Retrieve Rows Using TimeStamp Best SQL Query](https://srinimf.com/2011/10/06/db2-spufi-comparison-timestamp/)

It calculates following **Saturday Date **from **ship_date**.

Advertisements

- DAYNAME, DAYOFWEEK and MONTHNAME Functions need one parameter. i.e CURRENT TIMESTAMP.

## SQL Query [to Use](https://srinimf.com/2022/12/26/these-python-datetime-classes-developers-should-know/) Functions of DAYNAME, DAYOFWEEK, MONTHNAME.

```
SELECT CURRENT TIMESTAMP
,DAYNAME(CURRET TIMESTAMP)
,DAYOFWEEK(CURRENT TIMESTAMP)
,MONTHNAME(CURRENT TIMESTAMP)
FROM 
SYSIBM.SYSDUMMY1;
```

This SQL query extracts Day name, Day of week, and Month name.

1# **DAYNAME:**

Sunday, Monday,…

2# **DAYOFWEEK:**

1-Sunday, 2-Monday…

3# **MONTHNAME:**

JANUARY, FEBRUARY…

Related Posts

- [How to Retrieve Rows Using TimeStamp Best SQL Query](https://srinimf.com/2011/10/06/db2-spufi-comparison-timestamp/)DateOctober 6, 2011
- [DB2 DATE and Time Conversion: Top SQL Queries](https://srinimf.com/2022/10/22/how-to-understand-db2-date-and-time-sql-queries/)DateOctober 22, 2022
- [DB2 Date, Time Examples for Advanced Learners](https://srinimf.com/2017/01/03/the-best-db2-datetime-examples-for-advanced-learners/)DateJanuary 3, 2017

### Share this:

-
- [Tweet](https://twitter.com/share)
- [![](https://i0.wp.com/assets.pinterest.com/images/pidgets/pinit_fg_en_rect_gray_20.png)](https://www.pinterest.com/pin/create/link/?url=https%3A%2F%2Fsrinimf.com%2F2020%2F07%2F12%2Fnext_day-vs-dayname-top-sql-examples%2F&media=https%3A%2F%2Fi0.wp.com%2Fsrinimf.com%2Fwp-content%2Fuploads%2F2020%2F07%2Fsql-next_day-vs-dayname.jpg%3Ffit%3D1200%252C700%26ssl%3D1&description=NEXT_DAY%20Vs%20DAYNAME%20Top%20SQL%20Examples)
-
- [Share on Tumblr](https://www.tumblr.com/share)
- [Share on WhatsApp (Opens in new window) WhatsApp](https://srinimf.com/2020/07/12/next_day-vs-dayname-top-sql-examples/?share=jetpack-whatsapp)
- [More](#)
-

- [Print (Opens in new window) Print](https://srinimf.com/2020/07/12/next_day-vs-dayname-top-sql-examples/?share=print)
- [Share on Reddit (Opens in new window) Reddit](https://srinimf.com/2020/07/12/next_day-vs-dayname-top-sql-examples/?share=reddit)
- [Share on Telegram (Opens in new window) Telegram](https://srinimf.com/2020/07/12/next_day-vs-dayname-top-sql-examples/?share=telegram)
- [Email a link to a friend (Opens in new window) Email](mailto:?subject=%5BShared%20Post%5D%20NEXT_DAY%20Vs%20DAYNAME%20Top%20SQL%20Examples&body=https%3A%2F%2Fsrinimf.com%2F2020%2F07%2F12%2Fnext_day-vs-dayname-top-sql-examples%2F&share=email)
-

### Like this:

Like Loading…
