Overview
IntegrationsPricing

Date & Time

now

Displays the current date and/or time, using a format according to the Go's time format. Such string can contain format specifiers characters as described in the Go documentation.

INSERT INTO orders (amount, created_at) VALUES
  ({{ amount }}, '{% now "Mon Jan 2 15:04:05 -0700 MST 2006" %}');

In order to harmonize date and time formats in an organization and across systems, one could create a helper template containing a single format. For example, a file ./helpers/now.helper could look like:

{% now "Mon Jan 2 15:04:05 -0700 MST 2006" %}

Now, you can include this template wherever a current date with time is required:

INSERT INTO orders (amount, created_at) VALUES
  ({{ amount }}, '{% include "./helpers/now.helper" %}');

Which outputs:

INSERT INTO orders (amount, created_at) VALUES
  (12, 'Mon Jun 14 16:59:20 +0200 CEST 2021');

This avoids confusion around date and time formats but also simplies the writing of SQL queries.

Is something missing?

If you notice something we've missed or could be improved on, please follow this link and submit a pull request to the repository. Once we merge it, the changes will be reflected on the website the next time it is deployed.

Thank you for your contributions!