diff --git a/datafusion/functions/src/datetime/current_date.rs b/datafusion/functions/src/datetime/current_date.rs index 0ba3afd19bedb..18b99bca8638e 100644 --- a/datafusion/functions/src/datetime/current_date.rs +++ b/datafusion/functions/src/datetime/current_date.rs @@ -36,7 +36,9 @@ Returns the current date in the session time zone. The `current_date()` return value is determined at query time and will return the same date, no matter when in the query plan the function executes. "#, - syntax_example = "current_date()" + syntax_example = r#"current_date() + (optional) SET datafusion.execution.time_zone = '+00:00'; + SELECT current_date();"# )] #[derive(Debug, PartialEq, Eq, Hash)] pub struct CurrentDateFunc { diff --git a/datafusion/functions/src/datetime/current_time.rs b/datafusion/functions/src/datetime/current_time.rs index 79d5bfc1783c1..e206c8d28633a 100644 --- a/datafusion/functions/src/datetime/current_time.rs +++ b/datafusion/functions/src/datetime/current_time.rs @@ -34,7 +34,9 @@ Returns the current UTC time. The `current_time()` return value is determined at query time and will return the same time, no matter when in the query plan the function executes. "#, - syntax_example = "current_time()" + syntax_example = r#"current_time() + (optional) SET datafusion.execution.time_zone = '+00:00'; + SELECT current_time();"# )] #[derive(Debug, PartialEq, Eq, Hash)] pub struct CurrentTimeFunc { diff --git a/docs/source/user-guide/sql/scalar_functions.md b/docs/source/user-guide/sql/scalar_functions.md index ec2faf8b3d5df..37ebfd02ee289 100644 --- a/docs/source/user-guide/sql/scalar_functions.md +++ b/docs/source/user-guide/sql/scalar_functions.md @@ -2409,6 +2409,8 @@ The `current_date()` return value is determined at query time and will return th ```sql current_date() + (optional) SET datafusion.execution.time_zone = '+00:00'; + SELECT current_date(); ``` #### Aliases @@ -2423,6 +2425,8 @@ The `current_time()` return value is determined at query time and will return th ```sql current_time() + (optional) SET datafusion.execution.time_zone = '+00:00'; + SELECT current_time(); ``` ### `current_timestamp`