Skip to content

Commit be4f0ff

Browse files
Merge pull request #389 from metabase/backport-56-643695fc4475ea8906009da283fcc3489e425a96->release-x.56.x
[auto-build] backport-56-643695fc4475ea8906009da283fcc3489e425a96 -> release-x.56.x
2 parents 61beb4c + ff2df69 commit be4f0ff

File tree

2 files changed

+40
-6
lines changed

2 files changed

+40
-6
lines changed

_docs/v0.56/questions/query-builder/expressions-list.md

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ For an introduction to expressions, check out the [overview of custom expression
6464
- [concat](./expressions/concat)
6565
- [contains](#contains)
6666
- [date](#date)
67+
- [datetime](#datetime)
6768
- [doesNotContain](#doesnotcontain)
6869
- [domain](#domain)
6970
- [endsWith](#endswith)
@@ -107,6 +108,8 @@ For an introduction to expressions, check out the [overview of custom expression
107108
- [quarterName](#quartername)
108109
- [relativeDateTime](#relativedatetime)
109110
- [second](#second)
111+
- [timeSpan](#timespan)
112+
- [today](#today)
110113
- [week](#week)
111114
- [weekday](#weekday)
112115
- [year](#year)
@@ -434,7 +437,7 @@ Example: `sqrt([Hypotenuse])`.
434437

435438
Databases that don't support `sqrt`: SQLite.
436439

437-
Related: [Power](#power).
440+
Related: [power](#power).
438441

439442
## String functions
440443

@@ -501,9 +504,12 @@ Related: [datetime](#datetime)
501504

502505
> Available on PostgreSQL, MySQL/MariaDB, BigQuery, Redshift, ClickHouse, and Snowflake
503506
504-
Converts a datetime string to a datetime.
507+
Converts a datetime string or bytes to a datetime.
505508

506-
Syntax: `datetime(column)`
509+
Syntax: `datetime(value, mode)`
510+
511+
- `value`: The string, bytes, or number to convert to a datetime.
512+
- `mode`: Optional. The mode indicating the format. One of: `"simple"`, `"iso"`, `"simpleBytes"`, `"isoBytes"`, `"unixSeconds"`, `"unixMilliseconds"`, `"unixMicroseconds"`, `"unixNanoseconds"`. Default is `"iso"`.
507513

508514
Example: `datetime("2025-03-20 12:45:04")`
509515

@@ -938,6 +944,16 @@ Syntax: `timeSpan(number, text)`
938944

939945
Example: `[Orders → Created At] + timeSpan(7, "day")` will return the date 7 days after the `Created At` date.
940946

947+
### today
948+
949+
Returns the current date (without time).
950+
951+
Syntax: `today()`
952+
953+
Example: `today()` would return the current date, such as `2025-05-04`.
954+
955+
Related: [now](#now).
956+
941957
### [week](./expressions/week)
942958

943959
Takes a datetime and returns the week as an integer.

_site/docs/v0.56/questions/query-builder/expressions-list.html

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4908,6 +4908,7 @@ <h1 id="list-of-expressions">List of expressions</h1>
49084908
<li><a href="./expressions/concat">concat</a></li>
49094909
<li><a href="#contains">contains</a></li>
49104910
<li><a href="#date">date</a></li>
4911+
<li><a href="#datetime">datetime</a></li>
49114912
<li><a href="#doesnotcontain">doesNotContain</a></li>
49124913
<li><a href="#domain">domain</a></li>
49134914
<li><a href="#endswith">endsWith</a></li>
@@ -4954,6 +4955,8 @@ <h1 id="list-of-expressions">List of expressions</h1>
49544955
<li><a href="#quartername">quarterName</a></li>
49554956
<li><a href="#relativedatetime">relativeDateTime</a></li>
49564957
<li><a href="#second">second</a></li>
4958+
<li><a href="#timespan">timeSpan</a></li>
4959+
<li><a href="#today">today</a></li>
49574960
<li><a href="#week">week</a></li>
49584961
<li><a href="#weekday">weekday</a></li>
49594962
<li><a href="#year">year</a></li>
@@ -5299,7 +5302,7 @@ <h3 id="sqrt">sqrt</h3>
52995302

53005303
<p>Databases that don’t support <code class="language-plaintext highlighter-rouge">sqrt</code>: SQLite.</p>
53015304

5302-
<p>Related: <a href="#power">Power</a>.</p>
5305+
<p>Related: <a href="#power">power</a>.</p>
53035306

53045307
<h2 id="string-functions">String functions</h2>
53055308

@@ -5376,9 +5379,14 @@ <h3 id="datetime">datetime</h3>
53765379
<p>Available on PostgreSQL, MySQL/MariaDB, BigQuery, Redshift, ClickHouse, and Snowflake</p>
53775380
</blockquote>
53785381

5379-
<p>Converts a datetime string to a datetime.</p>
5382+
<p>Converts a datetime string or bytes to a datetime.</p>
5383+
5384+
<p>Syntax: <code class="language-plaintext highlighter-rouge">datetime(value, mode)</code></p>
53805385

5381-
<p>Syntax: <code class="language-plaintext highlighter-rouge">datetime(column)</code></p>
5386+
<ul>
5387+
<li><code class="language-plaintext highlighter-rouge">value</code>: The string, bytes, or number to convert to a datetime.</li>
5388+
<li><code class="language-plaintext highlighter-rouge">mode</code>: Optional. The mode indicating the format. One of: <code class="language-plaintext highlighter-rouge">"simple"</code>, <code class="language-plaintext highlighter-rouge">"iso"</code>, <code class="language-plaintext highlighter-rouge">"simpleBytes"</code>, <code class="language-plaintext highlighter-rouge">"isoBytes"</code>, <code class="language-plaintext highlighter-rouge">"unixSeconds"</code>, <code class="language-plaintext highlighter-rouge">"unixMilliseconds"</code>, <code class="language-plaintext highlighter-rouge">"unixMicroseconds"</code>, <code class="language-plaintext highlighter-rouge">"unixNanoseconds"</code>. Default is <code class="language-plaintext highlighter-rouge">"iso"</code>.</li>
5389+
</ul>
53825390

53835391
<p>Example: <code class="language-plaintext highlighter-rouge">datetime("2025-03-20 12:45:04")</code></p>
53845392

@@ -5824,6 +5832,16 @@ <h3 id="timespan">timeSpan</h3>
58245832

58255833
<p>Example: <code class="language-plaintext highlighter-rouge">[Orders → Created At] + timeSpan(7, "day")</code> will return the date 7 days after the <code class="language-plaintext highlighter-rouge">Created At</code> date.</p>
58265834

5835+
<h3 id="today">today</h3>
5836+
5837+
<p>Returns the current date (without time).</p>
5838+
5839+
<p>Syntax: <code class="language-plaintext highlighter-rouge">today()</code></p>
5840+
5841+
<p>Example: <code class="language-plaintext highlighter-rouge">today()</code> would return the current date, such as <code class="language-plaintext highlighter-rouge">2025-05-04</code>.</p>
5842+
5843+
<p>Related: <a href="#now">now</a>.</p>
5844+
58275845
<h3 id="week"><a href="./expressions/week">week</a></h3>
58285846

58295847
<p>Takes a datetime and returns the week as an integer.</p>

0 commit comments

Comments
 (0)