Usage
view: view_name {
  dimension: order_date {
    datatype: date
  }
}
| Hierarchy datatype | Possible Field TypesDimension, Dimension Group, Filter, Measure Default Value timestampAcceptsOne of several possible values | 
Definition
The datatype parameter lets you specify the type of time or date data in your database table that you are supplying to your dimension, dimension_group, filter, or measure field. Matching the data type to your field can increase query performance.
For dimensions, filters, and measures that contain date or time data, and for dimension groups with type: time, the datatype parameter applies to the sql parameter of the dimension group.
For dimension groups with type: duration, the datatype parameter applies to both the sql_start and sql_end parameters, so be sure the sql_start and sql_end are both of the specified data type.
The datatype parameter accepts the following values:
- epoch- a SQL epoch field (i.e., an integer representing the number of seconds from the Unix epoch)
- date- a SQL date field (i.e., one that does not contain time of day information)
- datetime- a SQL datetime field
- timestamp- a SQL timestamp field
- yyyymmdd- a SQL field that contains an integer that represents a date of the form YYYYMMDD
The default value for datatype is timestamp.
Example
Create a dimension_group for a date field. Set the datatype: to date to increase query performance.
dimension_group: order_date
  type: time
  timeframes: [date, week, month, year]
  datatype: date
  sql: ${TABLE}.order_date