---
title: "Discussion on \"The only date in SQL\" | Hashnode"
description: "Discussion on \"The only date in SQL\". Pros:\n\nNo varchar<->datetime conversions required\n\nNo need to think about the locale\n\n  -- 2 day ago\n  SELECT DATEADD(dd, 0, DATEDIFF(dd, 0, DATEADD(DAY, - 2, GETDATE())))\n  -- today\n  SELECT DATEADD(dd, 0, DATEDIFF(dd, 0, GETDATE()))"
url: "https://hashnode.com/posts/the-only-date-in-sql/644d385f0816712b1fc2c7de"
---

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

Discussion

# [The only date in SQL](https://karatas.dev/the-only-date-in-sql?utm_source=hashnode&utm_medium=feed)

Pros: No varchar<->datetime conversions required No need to think about the locale -- 2 day ago SELECT DATEADD(dd, 0, DATEDIFF(dd, 0, DATEADD(DAY, - 2, GETDATE()))) -- today SELECT DATEADD(dd, 0, DATEDIFF(dd, 0, GETDATE()))

Apr 29, 2023 · 1 min read · karatas.dev  
Read the article

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

## Written by

[Ferhat Karataş](https://hashnode.com/@karatas)

@karatas · Turkey

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

Software Developer

Performance freak

## Responses

Markdown supported · ⌘↵ to post

No responses yet.
