When creating a custom metric, you can use Grow's Date Interpolator to keep your metric current or to select a specific time period.

Most custom metrics will ask for a From Date and a To Date. You can type in specific dates, (start: Jan 1st 2016, end: Jan 31st 2016) but what if you want a time period to be dynamic?

You can use strings to manipulate the time period you want to retrieve. The basic string is: {{date('YYYY-MM-DD')}} 

This will always return the current date. 

You can then manipulate this string to get specific time periods or to return a specific amount of days, weeks, months, or years around to the current date.

So if the current date is this: {{date('YYYY-MM-DD')}}
To get the last 7 days you would enter this:  {{date('-7days','YYYY-MM-DD')}} in the From Date field and the string above in the To Date field.

You can do the same thing with other time frames as well.
To get data for one of the time frames below until the current day, you would set the listed string as the From Date and {{date('YYYY-MM-DD')}}  as the To Date.

From Beginning of Week

  • Start of week: {{date('start of week','YYYY-MM-DD')}}
  • This shows all of the data from the most recent Sunday up until the current day.


  • Start of last month: {{date('-1months','start of month','YYYY-MM-DD')}} 
  • End of last month: {{date('start of month','-1days','YYYY-MM-DD')}}


  • Start of quarter: {{date('start of quarter','YYYY-MM-DD')}} 
  • End of Last Quarter: {{date('start of quarter','-1days','YYYY-MM-DD')}} 
  • Start of Last Quarter: {{date('-3months','start of quarter','YYYY-MM-DD')}} 


  • Last year: {{date('-1years','YYYY-MM-DD')}}  
  • Last 2 years: {{date('-2years','YYYY-MM-DD')}

End of Month

  • End of month: {{date('+1months','start of month','-1days','YYYY-MM-DD')}} 

Custom Time Frames

You can also use the date interpolator to show a specific time period prior to the current date.

For example: enter {{date('-1years','YYYY-MM-DD')}}  into the From Date and {{date('YYYY-MM-DD')}}  into the To Date to return all data from one year ago to today's date.

You can also use the date interpolator to set a custom date range.

For example: enter {{date('-2months','YYYY-MM-DD')}}  into the From Date and {{date('-1months','YYYY-MM-DD')}}  into the To Date to get all of the data from last month.

IMPORTANT: When using these kinds of strings, the string entry should always be plural even if the amount is only one (i.e. 1 months or 1 days).

Adjusting For Time Zones

Grow's severs are on UTC time. You have the option to adjust the # of hours offset for your time zone.

Mountain Standard Time (MST): Created>={{date('-6hours','-30days','YYYY-MM-DD')}} 

Australia: Created>={{date('+10hours','-30days','YYYY-MM-DD')}}

Date Format Specification

Not only can the Interpolator manipulate dates to always be a certain number of days in the past, it also allows you to specify the date format.

The examples so far have used 'YYYY-MM-DD' in their format specification.
By putting a dash in between the YYYY, the MM, and the DD, the date output will look exactly like that: (2016-06-28).

Sometimes data sources expect dates in different formats. For example, Google Adwords sometimes expects date formats to look like this (20160628). In order to achieve that, you can just use that style for the format specification in the interpolator:{{date('YYYYMMDD')}}  Here, there are no dashes between year, month, and date. This will set the date to show as 20160628.

Important note: Always put the date format specification at the end, after you do all of the date manipulation.

If you need to get even more technical with hours, seconds, or Unix timestamps, Grow follows the patterns found here at this link http://momentjs.com/docs/#/parsing/string-format/

Questions? Chat in on the site or email us at support@grow.com.

Did this answer your question?