A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://docs.snowflake.com/en/sql-reference/functions/previous_day below:

PREVIOUS_DAY | Snowflake Documentation

Reference Function and stored procedure reference Date & time PREVIOUS_DAY
Categories:

Date & time functions

PREVIOUS_DAY

Returns the date of the first specified day of week (DOW) that occurs before the input date.

See also:

LAST_DAY , NEXT_DAY

Syntax
PREVIOUS_DAY( <date_or_timetamp_expr> , <dow> )

Copy

Arguments
date_or_timestamp_expr

A date or a timestamp, or an expression that can be evaluated to a date or a timestamp.

dow_string

Specifies the day of week used to calculate the date for the previous day. The value can be a string literal or an expression that returns a string. The string must start with the first two characters (case-insensitive) of the day name:

  • su (Sunday)

  • mo (Monday)

  • tu (Tuesday)

  • we (Wednesday)

  • th (Thursday)

  • fr (Friday)

  • sa (Saturday)

Any leading spaces and trailing characters, including spaces, in the string are ignored.

Returns

This function returns a value of type DATE, even if date_or_timetamp_expr is a timestamp.

Examples

Return the date of the previous Friday that occurred before the current date:

SELECT CURRENT_DATE() AS "Today's Date",
       PREVIOUS_DAY("Today's Date", 'Friday') AS "Previous Friday";

Copy

+--------------+-----------------+
| Today's Date | Previous Friday |
|--------------+-----------------|
| 2025-05-06   | 2025-05-02      |
+--------------+-----------------+

Your output will be different because the example uses the CURRENT_DATE function.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4