sqlcmd.net validated sql reference

#date

Commands grouped around the same concept, pattern, or recurring problem.

14 commands with this tag Browse related patterns quickly
intermediate date-time MySQL MariaDB SQL Server PostgreSQL SQLite

Add Or Subtract Days From A Date

Calculate a future or past date by adding or subtracting an interval from an existing date.

intermediate date-time MySQL MariaDB SQL Server PostgreSQL SQLite

Calculate The Number Of Days Between Two Dates

Find how many days separate two date values using each engine's date difference function.

intermediate date-time MySQL MariaDB SQL Server PostgreSQL

Convert a Timestamp to a Different Time Zone

Shift a stored UTC timestamp to a local time zone for display using engine-specific conversion functions.

beginner date-time MySQL MariaDB SQL Server PostgreSQL SQLite

Convert Timestamps To Dates

Strip the time portion from a timestamp so only the calendar date remains.

intermediate date MySQL MariaDB SQL Server PostgreSQL SQLite

Detect Overlapping Date Ranges

Find rows whose date or timestamp intervals intersect by checking that neither range ends before the other begins — using the `OVERLAPS` operator in PostgreSQL or a manual comparison in other engines.

beginner date-time MySQL MariaDB SQL Server PostgreSQL SQLite

Extract Date Parts From A Date Or Timestamp

Return components such as year, month, and day from a date or timestamp value.

intermediate date-time MySQL MariaDB SQL Server PostgreSQL SQLite

Extract The Year From A Date

Return the year component from a date or timestamp value.

advanced date MySQL MariaDB SQL Server PostgreSQL SQLite

Fill Gaps in a Time Series

Produce a row for every date in a range — even dates with no data — by generating a date spine and left-joining actual records onto it.

intermediate date-time MySQL MariaDB SQL Server PostgreSQL SQLite

Format A Date As A String

Convert a date value to a formatted string using a custom pattern such as MM/DD/YYYY.

beginner date-time MySQL MariaDB SQL Server PostgreSQL SQLite

Get The Current Date And Time

Return the current date and time using `CURRENT_TIMESTAMP` or engine-specific functions.

intermediate date-time MySQL MariaDB SQL Server PostgreSQL SQLite

Get The Day Of Week From A Date

Return the weekday number or name for a date using engine-specific date functions.

intermediate date-time MySQL MariaDB SQL Server PostgreSQL SQLite

Group Rows By Month

Bucket dates into month starts, then aggregate counts or totals per month.

intermediate conversion MySQL MariaDB SQL Server PostgreSQL SQLite

Parse A Formatted String Into A Date

Convert a text string in a known format into a native DATE value using engine-specific parsing functions.

advanced date-time MySQL MariaDB SQL Server PostgreSQL SQLite

Round a Timestamp Down to a Specific Unit

Truncate a timestamp to the start of a month, day, or hour using engine-specific functions.