---
title: "Discussion on \"SQL - Calculating Date Offset While Excluding Weekends\" | Hashnode"
description: "Discussion on \"SQL - Calculating Date Offset While Excluding Weekends\". In a current project, I needed to calculate the date offset while excluding weekends. Initially, this was solved using a loop in PL/SQL, which I consider a less efficient approach.\nTo optimize it, I created a straightforward SQL query that handles th..."
url: "https://hashnode.com/posts/sql-calculating-date-offset-while-excluding-weekends/670e422139c9633aa18c4e24"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [SQL - Calculating Date Offset While Excluding Weekends](https://blog.lucashir.eu/sql-calculating-date-offset-while-excluding-weekends?utm_source=hashnode&utm_medium=feed)

In a current project, I needed to calculate the date offset while excluding weekends. Initially, this was solved using a loop in PL/SQL, which I consider a less efficient approach. To optimize it, I created a straightforward SQL query that handles th...

Oct 15, 2024 · 2 min read · blog.lucashir.eu  
Updated Oct 21, 2024  
Read the article

-   [#oracle-sql](https://hashnode.com/tag/oracle-sql)
-   [#sql](https://hashnode.com/tag/sql)
-   [#oracle](https://hashnode.com/tag/oracle)

## Written by

[Lucas Hirschegger](https://hashnode.com/@lucashir)

@lucashir · Slovenia

  
[View profile](https://hashnode.com/@lucashir)

Senior Oracle APEX Consultant | Oracle ACE Associate ♠

Experienced Business Analyst with a demonstrated history of working in the airlines/aviation industry. Strong research professional with an engineering focus and a strong technical background. Skilled in SQL/PLSQL, Linux System Administration. A proud Oracle APEX Consultant.

## Responses 1

Markdown supported · ⌘↵ to post

[Jared C](https://hashnode.com/@jdc136)

[Oct 21, 2024](https://hashnode.com/posts/sql-calculating-date-offset-while-excluding-weekends/670e422139c9633aa18c4e24/comment/671667f3e6bb12889eae5ce0)

This is great, thank you. Curious if you've figured out how to do this while also excluding Holidays?

[Lucas Hirschegger](https://hashnode.com/@lucashir)

[Oct 21, 2024](https://hashnode.com/posts/sql-calculating-date-offset-while-excluding-weekends/670e422139c9633aa18c4e24/comment/671667f3e6bb12889eae5ce0#reply-67168a150034ccf87ab709f4)

Hello Jared, for holidays, I prefer to rely on a web service, I have updated the query.

[Jared C](https://hashnode.com/@jdc136)

[Oct 22, 2024](https://hashnode.com/posts/sql-calculating-date-offset-while-excluding-weekends/670e422139c9633aa18c4e24/comment/671667f3e6bb12889eae5ce0#reply-6717b6a0759c2f5125affac0)

Thank you! [Lucas Hirschegger](https://hashnode.com/@lucashir)
